[code] live resizing code for behaviour objects
Shao Sean
shaosean at wehostmacs.com
Fri May 15 09:00:52 EDT 2009
Thought I would make this code available for others who may want to
write custom controls and would like them to be resizable in the
IDE.. This code does live resizing when the control is resized from
the drag handles and will update (not live though) if you are using
the Geometry Manager on the control.
If anyone has my old Filter Field Widget they can see the code in
action in there, if not you will see some projects in the near future
that use this code :)
-Sean
ps. this code goes in the parentScript not the actual object's script
on resizeControl
_resizeControl
end resizeControl
on revCacheGeometry
_resizeControl
end revCacheGeometry
private command _resizeControl
constant kControlHeight = 0 -- set to 0 [zero] if no
contraining is required
local tLockLoc
lock screen
if (the environment = "development") then
put the lockLocation of me into tLockLoc
set the lockLocation of me to TRUE
--- ensure that the control is contrained in height; set to 0
[zero] if no contraining is required
if (kControlHeight > 0) AND (the height of me <> kControlHeight)
then
set the height of me to kControlHeight
end if
--- move and resize your control's components here
# <INSERT YOUR CODE>
----- end
set the lockLocation of me to tLockLoc -- restore the
control's original lockLocation setting
end if
end _resizeControl
More information about the use-livecode
mailing list