I've use an OM and FM like Arnaud since sometime in the last century:

C_LONGINT($1;$nFormEvent)  //FORM EVENT
C_TEXT($2;$tObjectName)  //OBJECT NAME FROM CURRENT METHOD NAME
C_POINTER($3;$pObjectPtr)  //SELF

C_LONGINT($nParamCount)
$nParamCount:=Count parameters

Case of

: ($nParamCount=3)
$nFormEvent:=$1
$tObjectName:=$2
$pObjectPtr:=$3


: ($nParamCount=2)
$nFormEvent:=$1
$tObjectName:=$2
$pObjectPtr:=OBJECT Get pointer(Object named;$tObjectName)


: ($nParamCount=1)
$nFormEvent:=$1
$tObjectName:=OBJECT Get name(Object current)
$pObjectPtr:=OBJECT Get pointer(Object named;$tObjectName)

else

$nFormEvent:=Form event
$tObjectName:=OBJECT Get name(Object current)
$pObjectPtr:=OBJECT Get pointer(Object named;$tObjectName)

end case

TBox_Trace_OnShift //ENTER TRACE MODE

Case of

*: *($tObjectName=kCons_fabLBoxValues)


case of

*: *($nFormEvent=On Clicked)

...etc.

Advantages:

I can post 4D events or my custom events to OM as if I had performed that
action with the object passed in param 2

any '___Orphan___' methods can be easily replaced with OM


I do the same thing with FM (Form Method).

If I need to re-initialise a form's objects, I could call FM(On Load) from
the object necessitating the re-initialisation.

Or I would sometimes execute the On Timer code without setting a timer,
FM(On Timer)


In the case of a contextual click in  a listbox, I would call OM(Form
Event; Object get name(Object Current))
-- 
Jim Dorrance
[email protected]
[email protected]
www.4d.dorrance.eu

PS: If you know of anyone that needs an experienced 4D programmer to add
energy and experience to their team, please let me know. I have
experience in many areas. Reasonable rates. Remote or Paris only.
**********************************************************************
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