Geometry Manager

Damien Girard dam-pro.girard at laposte.net
Tue Dec 21 13:47:38 EST 2010


You can also take a look at NativeGeometry that will handle for you all the
geometry management ;)

http://www.nativesoft.fr/nativegeometry

Kind Regards,

Damien Girard
NativeSoft, France.

-----Message d'origine-----
De : use-livecode-bounces at lists.runrev.com
[mailto:use-livecode-bounces at lists.runrev.com] De la part de Robert
Brenstein
Envoyé : mardi 21 décembre 2010 19:36
À : How to use LiveCode
Objet : Re: Geometry Manager


On 21.12.2010 at 10:13 Uhr -0800 Peter Haworth apparently wrote:
>Just started trying to figure out the geometry manager.  It appears 
>there is already a default for every control to scale it when the 
>user resizes the window.  Problem is, it doesn't happen.  If I 
>resize my window, all the controls on it that fall completely 
>outside the boundary of the window disappear and any that are 
>partially outside the window are cut off.
>
>I'd also add that I tried looking in the LC preferences to see if 
>there was a setting to enable/disable the geometry manager and, with 
>glx2 installed, the only preferences that I could get to were the 
>glx2 ones, not the LC ones.
>
>Pete Haworth
>

As others suggested, rolling your own geometry management is 
recommended for more complex situations. The built-in geometry 
manager works but to a certain complexity only, and when it breaks, 
the time and effort invested in setting it up will got to waste. You 
have indicated that your stack is not simple, so going with the 
built-in manager is not recommended. Others have already hinted that 
geometry management is not that difficult to program. Typically, you 
will have

on preOpenCard
  -- accommodate user-inflicted resizing which occured on another card
  myGeomMgr (the width of this cd),(the height of this cd)
end preOpenCard

on resizeStack pNewWidth,pNewHeight
   -- accommodate user-inflicted resizing on this card
   myGeomMgr pNewWidth,pNewHeight
end resizeStack

on myGeomMgr pNewWidth,pNewHeight
  -- card level geometry manager
  constant cMargin = 25
  # do the magic with bg objects
  myBgGeomMgr pNewWidth,pNewHeight -- optional
  # do the magic with card groups
  myGrpGeomMgr pNewWidth,pNewHeight -- optional
  # do the magic with cd objects
  ...
   -- an example resizing a field
  set the width of fld kListFld to pNewWidth-2*cMargin
  set the left of fld kListFld to cMargin
  ...
end myGeomMgr

Such a setup allows you to call your geometry management also from 
scripts, and allows you to pass parameters between scripts, if 
needed. Normally, one positions/resizes objects relative to card 
edges and other objects, dealing with width and height of each 
object. The order of positioning/resizing is often critical.

Robert

_______________________________________________
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






More information about the use-livecode mailing list