John:

You hit the same issue that I faced and I've drunk the KB "form controller"
Koolaid.

I've been using a wrapper routine + an OT Object to collect and pass data
into an ALP _OM for a long time. About a year ago, I took the much larger
step of using an Object to gather data about form events and then passing
the object to an _FM.

At first, my code captured the events in the form method which was then
passed the Object but I found that I was getting "dropouts". I think I ran
into the situation with a tab control where the user would click on it but
it didn't get focus so I never knew it was being clicked on.

The solution was to put a project method in every object on the form. The
project method is PROC_FormEventValues_Assign

C_LONGINT($0)


C_LONGINT($h_;$1)
$h_:=$1


PROC_FocusObjectPtr_Set ($h_;OBJ_WithFocus )
PROC_FocusObjectName_Set ($h_;OBJ_FocusName_Return )

PROC_CurrentObjectPtr_Set ($h_;OBJ_CurrentPtr_Return )
PROC_CurrentObjectName_Set ($h_;OBJ_CurrentName_Return )

PROC_FormEvent_Set ($h_;Form event)

PROC_gTablePtr_Set ($h_;gTablePtr_Get )

PROC_CurrentFormPage_Set ($h_;FORM Get current page)


$0:=$h_


  and here's how it's used


*FEATURE_FM* (*PROC_FormEventValues_Assign* (PROC_Handle))


PROC_Handle is a "process level" object that's opened for each process.


After working in this paradigm I've found it very convenient to work in and
very easy to debug. What has been a big switch is to move away from
designing methods to do "one thing and only one thing". After adopting this
style of programming, I work in _FM methods that are in excess of 500 lines
of code.

Key to this approach is the use of an Object, OT or 4D's object. The idea
of having to change parameters in hundreds of method calls goes right to
the heart of the fixed parameter list. Unless it's a most trivial piece of
code, I assign $1 as a c_Longint and then add the compiler declaration and
$h_:=$1 in the code. No question that lots of those routines all never be
passed on object but it's much easier to add them in when the method is
created rather than going back and shoehorning it in.


--
Douglas von Roeder
949-336-2902

On Tue, Nov 8, 2016 at 5:32 PM, John DeSoi <[email protected]> wrote:

> Hi Wayne,
>
> > On Nov 8, 2016, at 6:08 PM, Wayne Stewart <[email protected]>
> wrote:
> >
> > Have you tried OBJECT Get name(Object with focus)
> >
> > This should do what you want, well it did in my limited tests.
>
> It has the same problem as OBJECT Get pointer(Object with focus). In the
> form method, the value it returns in the On Clicked event is not
> necessarily the one the user actually clicked on. Example: A boolean field
> has focus and the user clicks on a non-focusable button. The function
> returns the field's object name even though the user clicked on the button.
>
> Thanks for the idea,
>
> John DeSoi, Ph.D.
>
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[email protected]
> **********************************************************************
>
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to