Basic Object Address Question - and wrapper answers sauce a la TAOO
MisterX
b.xavier at internet.lu
Tue Aug 23 12:29:05 EDT 2005
> On Behalf Of Eric Chatonet
> Dave,
>
> Try:
>
> put long name of group myGroup into myGroupName
> -- myGroupName is now a variable that includes all information about
> the control
> -- so you do not need to write: put the name of group myGroupName,
> but only:
> put the short name of myGroupName
Eric,
This is my favorite way to talk to objects...
put the long name of control x into thisobject
you can "do" everything "safely" now to your thisobject...
set the rect of this object to arect
except assuming thisobject is a field
delete line 2 of thisobject
or worse
put empty into thisfield
you are then working on the variable, emptying it's valuable content...
so this requires the clever dynamic script trick i love so much:
do "put empty into" && thisfield
[see the "do" command in the revdocs ;)]
Test it a bit... to avoid lengthy checking of what went wrong
try first to
get <command string> -- eg "get the time"
do it
If you breakpoint after the "get", you can easily see the command that is
going to be fed to the compiler... eh, sorry, interpreter... Dynamic scripts
are slower - but not that slow...
- wrappers a la Taoo - delicious with a great IDE like Rev...
This lends itself to wrappers anytime! How to build your own libraries? ...
do something to this library context object...
so in brief, we modularize and normalize (reduce) handlers to their minimum
such that they are strictly <verb><object> <params>. Here for a field class
library we have a great example... <verb><field> with some exceptions that
require dynamic scripting.
And it's the way TAOO or many other libraries work too - using both the
basic long name reference and the dynamic execution. I know some expensive
tools that dont do this and they suffer badly from it! Remember the key is
to use the long name. It avoids all confusions.
on ClearFields objs
repeat for each line thisobj in objs
if exists(thisobj)
then do "put empty into" && thisobj
end repeat
end ClearFields
For more examples, try my geometry manager GIM.rev on MonsieurX.com (easy to
'find').
Since the long name contains the full path to any control, you can't miss
working on the right field or tripping on a changed-name field!!!
Remember also that the long ID of a control is less likely to change within
a stack than a long name. That's assuming you dont replicate this one to
other stacks where names dont change but IDs do! - IDs have their short
comings too...
And so with that concludes this little trick of TAOO wrapping and Xtalk
object addressing in the single, plural form ;)
More about this very soon (ed.)
cheerios
Xavier
http://monsieurx.com/taoo
> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com
> [mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of
> Eric Chatonet
> Sent: Tuesday, August 23, 2005 17:09
> To: How to use Revolution
> Subject: Re: Basic Object Address Question
>
> Dave,
>
> Try:
>
> put long name of group myGroup into myGroupName
> -- myGroupName is now a variable that includes all information about
> the control
> -- so you do not need to write: put the name of group myGroupName,
> but only:
> put the short name of myGroupName
>
> Le 23 août 05 à 17:00, David Burgun a écrit :
>
> > Hi,
> >
> >
> > I am a bit confused, should the following code work?
> >
> > put the long name of card 1 into myCardName
> > put the name of control 1 of card myCardName into myControlName
> >
> > I get an error when I try to do this and changed the code to:
> >
> > put the name of control 1 of card myCard of stack myStack into my
> > ControlName
> >
> > Which is ok, but what I really want to be able to do is this:
> >
> > put long name of group myGroup into myGroupName -- String of
> > something like "group x of group y of group z of card c of stack s"
> > put the name of group myGroupName into myGroupName.
> >
> >
> > Any Ideas?
> >
> > Thanks a lot
> > Dave
>
>
> Best Regards from Paris,
>
> Eric Chatonet.
> ----------------------------------------------------------------
> So Smart Software
>
> For institutions, companies and associations
> Built-to-order applications: management, multimedia, internet, etc.
> Windows, Mac OS and Linux... With the French touch
>
> Free plugins and tutorials on my website
> ----------------------------------------------------------------
> Web site http://www.sosmartsoftware.com/
> Email eric.chatonet at sosmartsoftware.com/
> Phone 33 (0)1 43 31 77 62
> Mobile 33 (0)6 20 74 50 86
> ----------------------------------------------------------------
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage
> your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
More information about the use-livecode
mailing list