Here are some responses for questions asked in yesterdays webinar-
How to add a group to a group?
There are a few methods that you can use to do this-
1) using relayerGroupControls
Something like the following script will allow you to add two separate layers into the one layer-
Code: Select all
on mouseUp
put the layer of group "groupTop" into tWhatLayer
set the relayerGroupedControls to true
set the layer of group "groupOvals" to tWhatLayer +1
set the relayerGroupedControls to false
end mouseUp
2) Using copy
You can also use copy to insert a group into another group. This will leave the original group in place, so you may need to delete this-
copy group "groupOvals” to group "groupTop”
How to automatically reposition controls if one is deleted-
The following script has been taken from the distribution section of the property inspector. I altered it to only work on buttons but you should be able to adjust it for all control.
Simply add this script to a button called “test” and add multiple buttons to your card. Pressing the test button should distribute them evenly
Code: Select all
on mouseUp
-- repeating through your card to get long id's of all buttons
repeat with x = 1 to the number of buttons of this card
-- want to ignore button that triggers the script
if the name of button x is "button ""e&"test""e then
next repeat
end if
put the long id of button x & cr after tObjectNames
end repeat
put the number of lines in tObjectNames into tNumberOfObjects
put 0 into tWidth
--where the magic happens, and positions the buttons equally accross the cards
if tNumberOfObjects < 1 then exit to top
repeat with i = 1 to tNumberOfObjects
get line i of tObjectNames
add the width of it to tWidth
end repeat
get line 1 of tObjectNames
put word 5 to (the number of words in it) of it into tCardName
put the width of tCardName into tCardWidth
put (tCardWidth - tWidth) / (tNumberOfObjects + 1) into tPerSpace
put tPerSpace into tOffset
repeat with i = 1 to tNumberOfObjects
get line i of tObjectNames
set the left of it to round(tOffset)
add the width of it + tPerSpace to tOffset
end repeat
end mouseUp
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——