relayering groups within groups? (was : Moving groups inside a group)

Eric Chatonet eric.chatonet at sosmartsoftware.com
Fri Feb 3 01:04:58 CST 2006


Hi all on this thread,

First I apologize: I was tired last evening and did not remember this  
thread when I sent my own post.
Thanks to Jonathan and Claudi.
With a clear mind this morning, I found a very easy solution to my  
problem (relaying a sub group to front while keeping it in its main  
group):

on MoveGroupToFront pGroup
   copy grp pGroup to the owner of grp pGroup
   hide grp pGroup -- for reactivity
   delete grp pGroup
end MoveGroupToFront

Best Regards from Paris,
Eric Chatonet

Le 2 févr. 06 à 23:44, Jonathan Lynch a écrit :
> The only method I know of, is to move your subgroup to the bottom  
> of the
> group, then move all the other subgroups, in their current order,  
> to the
> bottom of the group. When you do this, your desired subgroup will  
> wind up on
> top, without any ownership changes.


Le 2 févr. 06 à 23:54, Claudi Cornaz a écrit :

> There is a trick I use to get sub-groups within a master group to  
> the top when they get selected.
> I have 2 invisible grafics (just  empty small rects) at the top of  
> the master group.
> Let's call them lowBoundry and highBoundry
> Now when the user selects a sub group and I want to bring it to the  
> front, I first move the
> sub group inbetween the 2 invisible graphics. In this way the sub  
> group
> does not become part of the highest sub group. Next I move the the  
> lowBoundry graphic
> to the top. So now from top to bottom: lowBoundry - highBoundy -  
> the sub group that was moved.
> So all we need to do now is move the highBoundry again to the top  
> to restore there right order.
>
> There is one important little "snag" though. Say the sub group to  
> move to the top is on layer 10
> and consists of 2 controls. The total of layers in the master group  
> (including the 2
> invisible graphics) is 16. This means the lowBoundry wil be on  
> layer 15.
> The moment you change the layer of a sub group it will first be  
> taken out of the stack.
> In this case the sub group consists of 2 controls, so the total  
> number of layers this sub group
> occupies is 3. This means the lowBoundry graphic will first fall  
> down to layer 12 (15 - 3). In essence
> all the controls above the sub group we move, will fall down by the  
> number of layers the moving group occupies.
>
> This trick works very fast and it doesn't matter how many sub  
> groups there are. Of course it only
> works to bring a sub group to the top, but probably when selecting  
> objects, something like this might
> just be what you need.
>
> I use it in a slightly more complex way in an application where I  
> have many sub groups but the
> sub groups are of different specific types. Let's say some have a  
> triangular shape, others
> a circular shape and the third kind are of square shape. Now when  
> the user selects a triangle
> it should move to the front of all triangles but always stay behind  
> the circles and the squares. The same applies
> of course to the circles and the squares. Each should move to the  
> top of it's kind but not cross the boundry to other types.
> Here I use 3 invisible graphics between the kinds. So above all  
> triangles there are 3 invis grc's then come
> the circles with also 3 invis grc's and next come the squares and  
> finaly again 3 invis grc's (actualy for the top,
> 2 graphics is enough) In between you need 3 graphics of which the  
> topmost never moves, but prevents
> the other 2 graphics to become part of a sub group when they are  
> switched around.

------------------------------------------------------------------------ 
----------------------
http://www.sosmartsoftware.com/    eric.chatonet at sosmartsoftware.com/





More information about the use-livecode mailing list