Group Conundrum Take 2 (Ignore first post)
Chipp Walters
chipp at chipp.com
Thu Sep 18 02:58:44 EDT 2008
Well, I figured it out..and boy is it simple..
When relayering a control, you first should find out if it is contained
within a group. If so then start editing the group. Identify the control you
wanted to move then simply:
get the layer of tControlID
set the layer of tControlID to it + 1 (moves it up one level)
set the layer of tControlID to it - 1 (moves it down one level)
set the layer of tControlID to top (moves it the the top of parent grp)
set the layer of tConrtolID to bottom (moves it the the bottom of parent
grp)
Note-- I said 'one level' not one layer. This is an important distinction.
The Rev engine already knows how to move groups around relative to each
other so setting a groups layer to one less than current will automatically
'skip' over all other controls owned by a lower group.
Pretty simple. I was focussed on setting layer numbers. This is much
easier-- and the trick is to work inside the edit group command. Also Ken
Ray's function is important as well-- as you can't get a unique long owner
for a control which is part of a group.
function stsLongOwnerID pObjID,pOpt_NumLevels
if pOpt_NumLevels = "" then put 1 into tNum
else put pOpt_NumLevels into tNum
if word ((4*tNum)+1) of pObjID is among the items of "group,card" then
delete word 1 to (4*tNum) of pObjID
end if
return pObjID
end stsLongOwnerID
-Chipp
More information about the use-livecode
mailing list