Greg Wills wrote:

Thanks Jim,

Your script will be of assistance in the laying out of the stack with
many icon buttons. I have been playing round with having a very small
dimensioned sub-stack with a picture on each card. I am only needing
small pictures at this stage.

Greg,

Here is a utility which I use to deal with buttons in the main stack whose image icons are in a substack. It relieves you of the need of setting to set the icon id and sizing the images and/or the buttons all in one fell swoop.

1) Put all the images on card 1 of the substack (mySubstack below.) Don't worry about size or position, that will be taken care of later. And resizing may distort the proportions. Doesn't matter if they overlap.
2) Next go through the main stack (myStack below) and create buttons with *the same name as the desired image in the substack* and in the desired location on each card. Also adjust the size of the button to the desired size of the eventual image. (Actually only the width matters. The height will be adjusted to avoid distorting the image proportions.)
3) Run setUp below from the main stack. All buttons will be assigned icon numbers of the image corresponding to the button name and the image in the substack is adjusted to fit within the button. And, as a bonus, you get an image border. If you don't want the border just: "set the showBorder of button tButtonName to "false." You can also set the color and width of the border. You may want to tinker with the edge number of ".98" below.
4) You can add images and button later if necessary and rerun "setUP".
5) Thanks to members of this list for help in developing this handler.



On setUpRev
Lock screen
repeat with i =1 to the number of cards
set the defaultstack to "myStack
go to card i
repeat with j = 1 to the number of buttons
put the short name of button j into tButtonName
put the width of button j into theButtonWidth
set the defaultstack to "mySubstack
if there is an image tButtonName then
put the id of image tButtonName into tImageID
put the formattedWidth of image tButtonName into tImageWidth
Put the formattedHeight of image tButtonName into tImageHeight
put tImageHeight/tImageWidth into ratioOfHeightToWidth
set the width of image tButtonName to theButtonWidth*.98 -- Leave an edge
set the height of image tButtonName to theButtonWidth*ratioOfHeightToWidth*.98
end if
set the defaultstack to "myStack"
set the icon of button j to tImageID
set the height of button tButtonName to theButtonWidth*ratioOfHeightToWidth
end repeat
end repeat
unlock screen
end setUpRev


Jim
_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to