Automatic object resizing on card changes

Björnke von Gierke bvg at mac.com
Fri Nov 4 07:42:02 EDT 2011


on opencard
   revUpdateGeometry
end opencard


Note: it is generally saver to write your own resize handlers. The geometry manger will sooner or later mess up, and strew your objects into random locations (negative or huge numbers, offscreen, huge mess!). I suggest to instead write your own resize code. That is a bit more upfront, but at least you know what goes wrong when it doesn't look as it should. For example:

--in the card script
on openCard
  resizeStack the width of this card, the height of this card
end openCard

--resizeStack is a built in handler
--it also happens when the user uses the OS-given resize capabilities of a window
on resizeStack theWidth theHeight
  set the rect of field "example" to 0,64,theWidth,theHeight --fills whole card, leaves space for controls at top
  set the right of button "example" to (theWidth - 16) -- right align a button
end resizeStack

On 3 Nov 2011, at 18:46, John Brozycki wrote:

> Hello,
> 
> Given a resizable stack with, say, two cards that both have objects that have their geometry set to scale on resize (like a text field) what is the best way to get objects on card 2 to automatically resize when card one is resized and then a button is selected to go to card 2?  It doesn't do this automatically- you have to resize the second card.  Make the second card much larger than the first was, and when you go back the objects on the first card are all off.  With each card, you have to manually resize for the objects to adjust properly.  Shouldn't this happen automatically when you configure the geometry settings?  I've tried using revWChangeWindowSize on my button to the next card, but it doesn't appear to do anything for object sizing.  Sorry if this is a basic question, but I can't find how to do this.
> 
> Much thanks,
> John
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


-- 
Watch live presentations every Saturday:
http://livecode.tv

Use an alternative Dictionary viewer:
http://bjoernke.com/bvgdocu/

Chat with other RunRev developers:
http://bjoernke.com/chatrev/





More information about the use-livecode mailing list