Objects in a group

Zac Elston zelston at aol.com
Wed Feb 13 16:40:01 EST 2002


On 2/8/02 10:29 PM, "use-revolution-request at lists.runrev.com"
<use-revolution-request at lists.runrev.com> wrote:

> on mouseUp
>   if word 1 of the name of the target is not "graphic" then pass mouseUp
>   if the redCircle of me is not empty
>   then set the backgroundColor of graphic ID (the redCircle of me) to gray
>   set the backgroundColor of the target to red
>   set the redCircle of me to the short ID of the target
> end mouseUp

I've received a few comments on this problem and I thank everyone for their
input.  This is great community support. Using a Custom Property really
opened my eyes to what was possible in Revolution.  Previously I had been
thinking very linearly, and I need to overcome that.

My application is a test that either reads answers from a file to show what
was selected or reads input from the user to write the file.

 read value Y from array[X] and change target Y in group X
 read target Y in group X and put the value of Y into array[X].

This saves me the trouble of scripting every group and then I can add lots
of goodies based on what X and Y are

I can only think of accomplishing this by knowing where the object is in the
group, hence the question..."how do I determine objects in a group?"

Rev support offered

  repeat with i = 1 to the num of graphics in me
...
  end repeat

But this only works if placed in the group script.

To make this work in the stack script I tried being very linear with

put word 5 of LongTargetName into MyGroupName
repeat with i = 1 to the num of graphics in group value(MyGroupName)
...
   end repeat

The problem comes from the fact that I have graphics in a group and each
group can have the same graphic names but with unique Ids.  So changing
graphic "1" actually only changes the first graphic "1" (ID 123) not the
graphic "1" (ID 321) in the group of the target.

Is it possible to use target IDs and group IDs?  I can't find any way to say

Put the objectIDs of group X into Alist
--(there doesn't seem to be a way to list objects unlike "put the groupIDs
of me into X")
Repeat for each line ThisLine in Alist
If the id of the graphic ThisLine is not the id of the target then
....


-zac







More information about the Use-livecode mailing list