The group command
dunbarx at aol.com
dunbarx at aol.com
Sun Feb 20 22:27:19 EST 2011
It is not stable. Scott is correct in that we all agreed that the only reliable workaround was to use the templateGroup to advantage. I wrote an addendum in the dictionary to the "last" keyword as it applies to groups:
The "last" keyword is not stable when referring to groups. So if one creates several groups, referencing the "last" group may not return the group actual ly created last. Using the "templateGroup" is a workaround, since when creating a new group one can, for example, set the name of the templateGroup to something unique, and be able to find the last group by name. Also, trapping the "newGroup" message with an appropriate script can be used to find the last group.
This is not an issue with other objects,
Craig Newman
-----Original Message-----
From: Richard Gaskin <ambassador at fourthworld.com>
To: use-livecode at lists.runrev.com
Sent: Sun, Feb 20, 2011 9:56 pm
Subject: Re: The group command
Peter Haworth wrote:
> The dictionary says I can refer to the group created by the group
> command by using the last keyword as in "last group". Has anyone
> used this successfully?
As the others here have noted, it's possible to create a group such that it won't be ordinally last.
Instead, you can take advantage of a convention the engines uses with reasonable consistency in which the local variable "it" will contain the long ID of a new object immediately after it's been created, e.g.:
create grp; put it
-- Richard Gaskin
Fourth World
LiveCode training and consulting: http://www.fourthworld.com
Webzine for LiveCode developers: http://www.LiveCodeJournal.com
LiveCode Journal blog: http://LiveCodejournal.com/blog.irv
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list