placing a group inside another using code...

Dick Kriesel dick.kriesel at mail.com
Tue Aug 14 22:29:13 EDT 2007


Hi, Andre.  Rev's "owner" property is read-only, but here's a way to
overcome that limitation, as long as the new owner is a group or a card in
the same stack as the old owner.

Please let me know if it works for you, or what happened if it doesn't.

-- Dick

<script>
setprop uOwner pNewOwner
  if first word of pNewOwner is among the items of "card,group" then
    put long owner of the target into tOldOwner
    if first word of tOldOwner is among the items of "card,group" then
      put long name of pNewOwner into tNewOwner
      if tNewOwner is not tOldOwner then
        if tNewOwner is not long name of the target then
          put the relayergroupedcontrols into tRelayerGroupedControls
          set the relayergroupedcontrols to "true"
          if first word of tNewOwner is "card" then
            set the layer of the target to 1
          else
            if the long name of the target is in tNewOwner then
              set the layer of tNewOwner to 1
            else
              set the layer of the target to the number of controls of this
card
            end if
            set the layer of the target to the layer of pNewOwner + 1
          end if
          set the relayergroupedcontrols to tRelayerGroupedControls
        else put "new owner is the target"
      else put "new owner is the old owner"
    else put "old owner must be a card OR a group"
  else put "new owner must be a card OR a group"
end uOwner
</script>





More information about the use-livecode mailing list