On Jun 20, 2007, at 3:34 AM, Stephen Barncard wrote:
watch out for the vague "me" reference and try something more
absolute, like the id or name of the object you are calling 'me'.
Sometimes getting the id of me or the owner of me works.
What's vague about "me"? As far as I'm concerned, "me" is the only
certain way to refer to a specific object: namely the one harboring
the script. Putting "the long ID of me" into a variable gives you
something you can pass around, for sure, but unless you already know
the total path to an object (e.g. button "OK" of grp "response" of
card 1 of stack "mydialog") being uncertain of object references is
the number one botheration in writing general purpose handlers.
"...of this card", "...of this stack", "...of the default stack", or
"...of the topstack" are all pigs in pokes.
What I often wish for is the extension of "me" into "my", as in for
any control:
my stack
my mainstack
my owner
my card
Currently, only "my owner" can be obtained by using "of me"; all the
others require parsing the long name or ID.
If you've tried scripting palettes (where "this stack" refers not to
the the palette but to the default stack) you may have adopted the
strategy of putting button scripts into the palette's card or stack
and using "of me" to refer to controls on the palette itself. How
much nicer it would be to put in a button script:
on mouseup
set the hilite of button "choice2" of grp "choices" of my
card to true
end mouseup
instead of something like
on mouseup
set the hilite of button "choice2" of grp "choices" of card
"xxx" of stack "yyy" to true
end mouseup
where you have to change xxx and yyy every time you reuse the button
in another context, or you might make xxx and yyy globals (ugh!) that
you have to set in opencard and openstack (and then forget about when
you reuse the button), or go though a rigamarole involving delimiters
and/or offsets to parse the long name of "me" to get the cardname and
stackname either in the mouseup handler or in a utility function
somewhere (that you now have to include in every project, like it or
not).
Consider voting for 'bug' 3446 if you agree.
t
--
Tereza Snyder
Califex Software, Inc.
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution