Hi,

With all the recent object stuff, I notice most people are using either
Cannon's excellent OBJ module or similar.

I have extended it so I have one routine do both tasks, I like this as it
means I only have one method to remember and not two.  There is obviously
some overhead copying the variable into $0 but I've never seen any impact
from this.  At least not with the variables I've used.

Does anyone else do this?

If you don't, why not?

Eg (based on Cannon's module):

C_OBJECT($AnObject_o)
C_TIME($WhenStarted_h;$WhenFinished_h)

$AnObject_o:=OBJ_Create
OBJ_Set_Time ($AnObject_o;"Start";Current time)
$WhenStarted_h:=OBJ_Get_Time ($AnObject_o;"Start")

FO_Time ($AnObject_o;"Finished";Current time)
$WhenFinished_h:=FO_Time ($AnObject_o;"Finished")

Internally FO_Time does this:

C_OBJECT($1;$Object_o)
C_TEXT($2;$Key_t)  //Can use dot notation
C_TIME($3;$Value_h;$0)

$Object_o:=$1
$Key_t:=$2

If (Count parameters=3)
  $Value_h:=$3
  OBJ_Set_Time ($Object_o;$Key_t;$Value_h)
Else
  $Value_h:=OBJ_Get_Time ($Object_o;$Key_t)
End if

$0:=$Value_h  //  Always return a value, 4D doesn't mind if you don't
receive it


Regards,

Wayne


[image: --]
Wayne Stewart
[image: http://]about.me/waynestewart
<http://about.me/waynestewart>
**********************************************************************
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