Discussion:
Moving array elements
ER
2018-11-17 17:41:41 UTC
Permalink
Hi,

Does XOJO have anything built in to move array elements around ? I have a project where when a picture is added to the canvas its also stored in an array (object array). So when drawn it does so as they were entered into the array.
I ‘m looking to add a “move forward/backward” option so I can moves an object(’s) in front of behind others.

Thanks.
Jon Ogden
2018-11-17 17:45:36 UTC
Permalink
Not really. You can do it manually pretty easily.

There’s a number of functions:

Sort
Shuffle
Pop
Remove
Insert

Easiest way is to take the element you want remove it from the array and then insert it back into the position where you want it. It’s quite simple to do.

You might want to consider putting items into a dictionary instead. Then you don’t need to worry about the order. You have a keyword instead for each item in the dictionary and then you grab the item you want based on the keyword.

Jon
Post by ER
Hi,
Does XOJO have anything built in to move array elements around ? I have a project where when a picture is added to the canvas its also stored in an array (object array). So when drawn it does so as they were entered into the array.
I ‘m looking to add a “move forward/backward” option so I can moves an object(’s) in front of behind others.
Thanks.
Emile Schwarz
2018-12-01 09:05:05 UTC
Permalink
At the bottom of:
http://docs.xojo.com/index.php/Array

Read the See Also paragraph


Le samedi 17 novembre 2018 18:45:05 UTC+1, ER <***@gmail.com> a écrit :

Hi,

Does XOJO have anything built in to move array elements around ? I have a project  where when a picture is added to the canvas its also stored in an array (object array). So when drawn it does so as they were entered into the array.
I ‘m looking to add a “move forward/backward” option so I can moves an object(’s) in front of  behind others.

Thanks.

Continue reading on narkive:
Loading...