Resizing During Resizing
Rob Cozens
rcozens at pon.net
Sun Nov 13 11:19:38 EST 2005
Hi All,
I want to be able to change the height or width of a stack from
inside the stack's resizeStack handler without triggering a second
resizeStack message.
I have created a portfolio of photographs of my wife's art. All
photos have a 3 (w) to 2 (h) orientation/proportion and the stack
layout is designed to retain same. In resizeStack, I check to see
whether the user has resized the height to a greater degree than the
width or vice versa, and then change the other dimension to retain
the 3 to 2 proportion. Here is a test handler based on my handler:
on resizeStack newWidth,newHeight,oldWidth,oldHeight
beep
lock screen
put abs(newWidth-oldWidth) into widthDifference
put abs(newHeight-oldHeight) into heightDifference
lock messages
if widthDifference >= heightDifference then set the height of this
stack to trunc((newWidth/3)*2)
else set the width of this stack to trunc((newHeight/2)*3)
unlock messages
unlock screen
end resizeStack
When I run this handler I hear two beeps, indicating that a
resizeStack message is sent when a stack dimension is changed, even
though I have locked messages. I suppose I could add logic to set
and check a local variable; but I'm wondering--
* Does this happen in 2.6.1?
* Why does the second resizeStack message get sent when messages are locked?
* Why doesn't the logic loop recursively (ie: why doesn't the second
resizeStack message trigger a third)?
Rob Cozens CCW
Serendipity Software Company
"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."
from "The Triple Foole" by John Donne (1572-1631)
More information about the use-livecode
mailing list