Page 1 of 1

Tip! Getting RevCacheGeometry to work

Posted: Sun Jun 15, 2008 11:07 pm
by whelkybaby
I've finally got some code to work as intended and discovered an undocumented feature of the revCacheGeometry command.

The background is that I've been using the geometry manager in my projects and so far (touch wood) I've not had any problems, even with very complex layouts. However, one of my scripts has to resize a group and a few controls within it.

In simplified code, it looks a bit like this:

Code: Select all

on changeHeight pTheHeight
   -- work out some dimensions and points
   put the top of group "theGroup" into lTheTop
    
   -- set the dimensions of the group
   set the height of group pTheTargetGroup to pTheHeight
   set the top of group pTheTargetGroup to lTheTop

   -- set the dimensions of other controls
   set the height of field "theField" of group "theGroup" to pTheHeight - 20
   set the top of field "theField" of group "theGroup" to lTheTop + 20

   etc. etc.

   revCacheGeometry
end changeHeight
The manual says to use a RevCacheGeometry command, but on the next resize, everything reverts back.

I've discovered that using:

Code: Select all

RevCacheGeometry true
in its place does in fact store the new sizes and placements of the controls and everything works thereafter as intended.

Cheers,

Steve