'Last group' et al. not working right
jswitte at bloomington.in.us
Fri Apr 25 01:13:05 EDT 2003
I'm using the following script to collect various objects into two
groups, which I then name frameOne and frameTwo:
global gLeftItems, gRightItems
-- group the left items
get "group control" && quote & "leftFrame" & quote
repeat with i=1 to number of lines in gLeftItems
put " and control id" && (line i of gLeftItems) after it
set name of last group to "frameOne"
-- group the right items
get "group control" && quote & "rightFrame" & quote
repeat with i=1 to number of lines in gRightItems
put " and control id" && (line i of gRightItems) after it
select the last group
set name of last group to "frameTwo"
'rightFrame' and 'leftFrame' are both graphics, on the right and left
sides of the screen.
If I cancel the script after the first group command is executed,
everything is fine, with the group frameOne where it belongs. But when
I change the script to execute the second group command as well, *both*
groups turn out to have the name frameTwo.
But it gets stranger: when the selected object is the group on the
*left* of the screen, not the right. And the name of the group on the
left (as reported in the Property Inspector) is *still* frameOne when
the script stops, but as soon as I click on the pointer tool, it
changes to frameTwo.
I just reopened the stack and ran the script again, and it worked as
it should (sort of): when the script stops, the group on the *right* is
selected, and is still named the default 'group id ...', but when I
clicked on the pointer tool, it changed to 'frameTwo' (as it should).
But then I got the spinning ball of death and Rev quit unexpectedly
after about 5 seconds. This strange behavior also occurs in Rev 1.1.1.
There seems to be a repeatable pattern to the errors: I open the
stack in 2.0, then run the script, and the second behavior occurs
(where the group name's end of up correct, but not until I select the
pointer tool). If I then select each group and execute 'ungroup' from
the message box and run the script again, the first behavior (where
both groups end up with the name frameTwo.
Anybody want a copy of the stack to play with?
More information about the use-livecode