I have published a component on Forum4D with that comment :

This component emulates 4D standard commands for objects such as OB Set or OB 
Get to add access to properties or sub-objects by path with dot notation.
It has been clearly inspired by OBJ_Module of Cannon Smith but differs by :
- it emulates standard commands and does not have commands by type
- it resolves paths with arrays elements
- it gives some advanced controls such as search in an array by the value of a 
property.
It does not intend to replace all functions of OBJ_Module.
You can download it here 
<http://forums.4d.fr/4DBB_Main/x_User/4018/files/18896249.zip>.
Method OBJ_Test gives several operational examples ; some functions are not yet 
implemented.

My answer is that I separate setter and getter ; the two commands have same 
syntax and you can copy the setter, change one letter and have the getter 
     OBJ_Set(MyObject;"MyPath";->MyValue)
     ... do something
     OBJ_Get(MyObject;"MyPath";->MyValue)


Direct access to the post where you can download the component : 
http://forums.4d.fr/Post//18896257/1/ <http://forums.4d.fr/Post//18896257/1/> 

Cordialement,

Bernard Escaich


> Le 9 janv. 2017 à 01:47, Wayne Stewart <[email protected]> a écrit :
> 
> 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]
> **********************************************************************

**********************************************************************
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