Hello,
There have been many requests on how to handle resizing of stacks for multiple resolutions and frankly I'm tired of answering them. Here is a script that will scale and position your controls proportionally.
Code: Select all
on mouseUp
put the height of this stack into tHeight
put the width of this stack into tWidth
put "on resizeStack" & cr & "put the height of this stack into tHeight" & cr & "put the width of this stack into tWidth" & cr into tResize
repeat with i = 1 to the number of controls of this cd
put the long id of control i into tName
if tName = the long id of me then next repeat
put wordOffset("stack",tName) into tWord
put word 1 to (tWord -2) of tName into tName
put the rect of control i into tSize
put round(item 1 of tSize / tWidth,3) into tLeft
put round(item 2 of tSize /tHeight,3) into tTop
put round(item 3 of tSize / tWidth,3) into tRight
put round(item 4 of tSize / tHeight,3) into tBottom
put "set the rect of" && tName && "to" && "round(" & tLeft & "* tWidth)" & comma & "round(" & tTop & "* tHeight)" & comma & \
"round(" & tRight & "* tWidth)" & comma & "round(" & tBottom & "* tHeight)" & cr after tResize
end repeat
put "end resizeStack" after tResize
set the clipboardData["text"] to tResize
answer information "The script has been copied to the clipboard, paste it into the stack script" titled "Now paste it"
end mouseUp
Click on the button and a resize script will be placed in the clipboard.
Paste the script into the stack script.
Delete the new button.
Knock your socks off resizing.
I figured this out from the lessons:
http://lessons.runrev.com/s/lessons/m/4 ... esolutions
and here:
http://runrev.com/developers/documentat ... rs-course/
NOTES:
This scales proportionally i.e. If you have a square object and do not resize the stack proportionally it won't be square anymore.
This only deals with 1 card, the script can be easily modified for all your cards.
This does not include any image handling, if your button icons use images you have to figure out how to make them look nice. Would have used strikethrough but not an option here.
Import your graphics including button icons at the largest size for your app (possibly iPad retina) and set their quality to "good", manually resize them so they look good on your smallest stack size.
This does not change font sizes.
This is only a starting point, there can be many cases where it just makes things look funny, refine it for yourself.
I hope someone will post a aspect ratio scaler script.
Have fun learning LiveCode,
Simon
EDIT: Here are links to other resizing resources:
Great Chipp Walters plugin, watch the video to see how to use it.
http://youtu.be/vY6r46O0cVA
then download the plugin
http://www.gadgetplugins.com/altplugins ... esizer.rev
And splash21's
http://mobgui.com/morph.php