Trying to understand the inner workings of ResizeStack

Mark Waddingham mark at livecode.com
Tue Mar 15 05:03:18 EDT 2016


On 2016-03-14 15:58, Terence Heaford wrote:
> 1. If you drag a window to resize it, the resize message is sent more 
> than once?

The OS dispatches a sequence of window resize requests, which the engine 
acts upon in turn.

> 2. and resizeStack is called each time? Is the screen locked more than
> once and is it accumulative.

The screen is locked around the entire dispatch of resizeStack - however 
the engine uses the same lock screen counter and mechanism as script 
does, so if you unlock screen in your resizeStack handler the engine 
will try and update the screen after each command. Whether or not this 
has a pleasant effect will likely depend on the OS.

> 3. Does resizeStack automatically unlock the screen after each pass?

Yes.

> 4. Do multiple resizeStack messages get sent by LC even though
> myUpdateGeometry and dispatch “refreshChart” may not have completed
> (if they are long scripts)?

No - the engine only executes one handler at a time and if the screen is 
locked then resizes are suspended until it is unlocked again. The net 
effect being, assuming you don't unlock the screen, then you won't get 
any recursive invocations of resizeStack.

> 5. Is it necessary to call lock screen in myUpdateGeometry and
> dispatch “refreshChart”?

No - the screen is implicitly locked before the resizeStack message is 
sent, and unlocked afterwards. Then the screen is explicitly updated.

> Because I get a weird screen flash in “refreshChart” if the first line
> of the script is not unlock screen.

Without actually seeing the flash and the code it is very difficulty to 
diagnose what the problem is. If you file a bug in the quality center 
with a sample stack and recipe, we can take a look.

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps




More information about the Use-livecode mailing list