and a new GM is born for everyone...

MisterX b.xavier at internet.lu
Sat Apr 16 02:20:23 EDT 2005


For some limited uses RunRev's Geometry engine is just great...
 
I've had my share of setbacks using it and here is the solution for all
those that do want to use a scalable any-complexity Geometry management
scheme across any xTalk system and with much more flexibility than RunRevs
in my opinion. 

While i'll make a tool to make this much simpler, i thought i'd share it
with everyone... It's just too easy and really powerful! I'll hint so extra
uses that im adding to a stack that will be released later before next
weekend.

So here goes

put this into your stack script...
<this>
on resizeStack
  MagicGM
  pass resizestack -- if you dont pass, the RevErrorDialog (RED) or other
stacks might not resize correctly although the RED still doesnt yet...
end resizeStack

on MagicGM
  put the number of controls into controlsmax
  repeat with x = 1 to controlsmax

    if "doresize" is in the script of control x then
      send "doresize" to control x
    end if

  end repeat
end MagicGM
</this ;>

-- be careful debugging control x's doresize script, i've had rev hickups
and lockups... Save first.

In any control x, you can write the simplest or most complex resize or move
script such as

on doresize
  set the rect of me to the rect of this cd 
  -- or 
  -- ResizeToObj the long name of me, the longname of this cd
  -- [, withframeoffset|rect][,withshadowoffset|rect] 
  -- using the TAOO GM agent
end doresize

If there are a number of related controls (a menu or an arrangement or
series of fields in columns), it's best to group them (like a template in
TAOO) and you put the doresize in the Group's script. 

This way the group is in charge of the resizing for its children so to
speak. Although you can also add local dependencies to the sub controls
inside the group (i do not recommended as it could cause
relative-unwanted-changes to other controls.

Notes:
The repeat script could (and should) be speeded up by checking if the
control has customprops (which would be the <ResizeToObj obj1 longID,obj2
longID,borderrectoffsetfromobj2,shadowrect,Z options,zdistancefadingratio>
call itself!

The number of controls might require this in terms of speed (querying if the
script contains is long) - the agent also uses a cached index to speed this
up in the repeat loop though. I have also found that I use mostly templates
and thus limit the repeat search to just groups so scripts are more
dedicated or localized.

One thing against the use of custom props... 

A change in stack name or control name (or id if you prefer to use that)
could require extra scripting or Custom prop changes. This is why im more
fond of adding a dynamic script than static [hard to debug] data.

Any ideas or suggestions on the matter are welcome. I know this subject has
earned me a flameworthy reputation but the google amount of hours I have
lost, the number of freezes, resizes, etc are a thing of the past... It's
sad to rewrite the wheel but if the original wheel is too square, it is good
to rewrite it if only for the evolution of the revolution beyond...

Chipp, if you are interested in this for your gui builder, let me know... 

The MagicGM genie plugin will be ready sometime before next weekend.

cheers
Xavier
--
http://MonsieurX.com - The Art Of Objects



More information about the use-livecode mailing list