More efficent checking of multiple objects

Jan Sælid selid at broadpark.no
Tue Nov 1 11:37:29 EST 2005


Thanks Dave

That I will do. Really useful.

Jan
----- Original Message ----- 
From: "David Burgun" <dburgun at dsl.pipex.com>
To: "How to use Revolution" <use-revolution at lists.runrev.com>
Sent: Tuesday, November 01, 2005 5:03 PM
Subject: Re: More efficent checking of multiple objects


> Hi,
>
> Here's something I did that you may be able to adapt. In my case they 
> objects are rectangles and the label/name field is not displayed. Also all 
> that needed to happen was if the rectangle was clicked, an action specific 
> to that rectangle had to be performed. To do this I did the following:
>
> Setup an array that has the key being the (long) name of the button and 
> the data as the value of being an object-specific field.
>
> If the user re-ordered the rects all that needed to be done was to swap 
> the data field of the Array between objects, e.g.
>
> Given the following Rectangle List:
>
> R1,R2,R3,R4,R5,
>
> The Array would look like this:
>
> "R1",VALUE1
> "R2",VALUE2
> "R3",VALUE3
> "R4",VALUE4
> "R5",VALUE5
>
> if user changes the position so that R5 comes after R2
>
> R1,R2,R5,R3,R4,
>
> "R1",VALUE1
> "R2",VALUE2
> "R3",VALUE5  <-----
> "R4",VALUE3
> "R5",VALUE4
>
> So all that is done is to move VALUE5 into R3, VALUE3 into R4 and VALUE4 
> into R5.
>
> Then in the mouseUp handler for each rectangle:
>
> on mouseUp
> put theArray[the name of me] into myValue
> put DoMouseUpInRect(the name of me,myValue) into myResult
> end mouseUp
>
> You could do the same using custom properties for each object, but I found 
> this harder to maintain and debug.
>
> Don't know if this would help in your case, but maybe you can adapt the 
> idea.
>
> All the Best
> Dave
>
>>Dear Jan,
>>
>>>I use a repeat with T=1 to (the number of buttons of group "Timeline")
>>>because I need to reorganize all the other buttons if the user moves just 
>>>one of them.
>>>
>>>In the future the user can have up to 1000 of these buttons in the 
>>>timeline. At this point I guess the repeat loop will be very slow.
>>>
>>>Is there a more efficient method I can use here?
>>
>>If the user eliminates or changes button x, is there any need to adjust 
>>buttons 1 through (x-1)?  If not, you can start T=X to (the number of 
>>buttons of group "Timeline".  It won't help much if the target is button 
>>1; but it should help lots if the target is button 999.
>>
>>If the relationship of the buttons is different such that action on button 
>>x can require changes to buttons 1 to (x-1), I'd need to know more to 
>>offer further suggestions.
>>
>>Rob Cozens, CCW
>>Serendipity Software Company
>>
>>Vive R Revolution!
>>_______________________________________________
>>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
>
> _______________________________________________
> 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