relayering groups within groups

MisterX b.xavier at internet.lu
Fri Feb 3 03:12:43 EST 2006


Terry,

Here's a bit of TAOO (see my sig) for layering groups, which I just added to
the GIM library (see url below) this morning.

Now for Terry's purpose, and if we are using the
relayerGroupedControls=true, we have to consider that to move group B
between group A or C we have to look at a delta of X controls. 

The delta is the difference between the layer of control 1 of group B (which
is the layer of group B), and the layer of group A 

or, going up,  the layer of control (the number of controls in group C)+1.

Thus when we want to move B below A, we either make all controls in A higher
by the delta or we make the controls of group B lower by the delta.

SendObjsLower returndelimitedlistofcontrolslongnames, (the layer of group
theGroupBelow

However there is another way to move the groups!

This one with the relayerGroupedControls set to true where is supposed to be
effective but it is more time consuming. 

See below for the second method - which may not be as simple as you think -
or safe.

/*
* GIM Control layer handlers
*/

-- TAOO Conventions:
-- object Objs is obviously a CR delimited list of the long names of the
controls you want to move or just one long name of a control.

on SendObjsToBottom objs
  repeat for each line obj in objs
    set the layer of obj to 0
  end repeat
end SendObjsToBottom

on SendObjsToTop objs, ObjOwner
  put the number of controls in objOwner +1 into TopCount
    repeat for each line obj in objs
    set the layer of obj to TopCount
  end repeat
end SendObjsToTop

-- The statement relayerGroupedControls can be optional or controlled with
additional parameters or a global/local setting.

on SendObjsLower objs, layerslower
  set the relayerGroupedControls to true
  repeat for each line obj in objs
    set the layer of obj to the layer of obj - layerslower
  end repeat
  set the relayerGroupedControls to false
end SendObjsLower

on BringObjsHigher objs, layershigher
  set the relayerGroupedControls to true
  repeat for each line obj in objs
    set the layer of obj to the layer of obj + layershigher
  end repeat
  set the relayerGroupedControls to false
end BringObjsHigher


on SendObjsToLayer objs, newlayer
  repeat for each line obj in objs
    set the layer of obj to newlayer
  end repeat
end SendObjsToLayer

--
Method 2 - adapted from the Control Browser in MetaCard to ControlsNO2
plugin and again for this purpose
--

on MoveObjectDown obj
  
  put the long name of the owner of obj into thisowner
  put the layer of obj into controlid
  
  local grpedit = false
  local mustgoback = false
   
  if word 1 of is "Group" then
    start editing thisowner
    put true into grpedit
    get the layer of obj - 1
  else
    get controlID-1
  end if
    
  set the layer of obj to it
  
  if grpedit then
    stop editing thisowner
  end if

end moveObjectDown

other variations on the GIM library like moveup, movedown, setdepth, etc
exist.  
-- 

I haven't tested ANY of the above since I just made them up. But any
feedback is welcome. Left out for this short mail was the error checking and
reporting. Locking the screen should be left up to the calling script(s). 

Examples of smooth layer handling and availability of GIM (with scripts
above in action):

GIM is currently dependent of the TAOO XOSMediaLib for skinning and icons.
But you can find both here. XOSMediaLib is a conglomerate of groups embedded
into a smooth model. Resizing the groups, moving them, etc is really easy
and reliable. Im sure many will like the object-orientation (I didn't say it
is all oop compliant) of the geometry management. (GUI OS issues aside
please, I still haven't got a new mac to fix those):

Meanwhile, here's how it looks really and where you can find GIM and
XOSMediaLib.

<http://monsieurx.com/modules.php?name=News&file=article&sid=193>

I've updated the downloads but haven't added a new article so see the
changes on-stack... I lot lots of changes to xosmedialib in a revcrash or a
backup restore problem recently and have to redo improvements again ;(

--

Eric just got ahead of me again too ;) 
So, there is another way after all!

cheers
Xavier
http://monsieurx.com/taoo





More information about the use-livecode mailing list