Page 1 of 1
Resizing header graphic
Posted: Tue May 01, 2012 11:46 pm
by jalz
Hi all,
I've created a header for my card by placing a blank button and filling it with the background of the image. Seems to work well, however I would like the header to stretch horizontally along if the user decides to stretch the window. Is there a way I can create a header graphic that stretches an shrinks horizonrally according to the size if the window?
Many thanks
Jalz
Re: Resizing header graphic
Posted: Tue May 01, 2012 11:59 pm
by mwieder
Try something like this in the script of the first card of the stack:
Code: Select all
on resizestack
lock screen
set the width of image 1 to the width of me
set the top of image 1 to the top of me
set the left of image 1 to the left of me
unlock screen
end resizestack
But note that images don't scale very quickly, so this may appear a bit jerky.
Re: Resizing header graphic
Posted: Wed May 02, 2012 8:26 pm
by jalz
Thanks mweider for starting me off.
After a little trial and error and looking at the dictionary to find out how things work - the following code seems to work quite nicely.
Code: Select all
on resizestack
lock screen
set the width of button "button 1" to the width of me
set the top of button "button 1" to 0
set the left of button "button 1" to 0
unlock screen
end resizestack
Re: Resizing header graphic
Posted: Thu May 03, 2012 4:28 pm
by jacque
The resizeStack message also includes two parameters which are the width and height of the stack. So an alternate way to do this would be:
on resizestack x,y -- these params are sent by the engine
lock screen
set the width of button "button 1" to x
set the topleft of button "button 1" to 0,0
unlock screen
end resizestack