Detecting when resizeStack is completed

Mark Waddingham mark at livecode.com
Fri Aug 18 12:29:47 EDT 2023


On 2023-08-18 17:03, David Epstein via use-livecode wrote:
> How can I redraw objects after the user has resized the stack, but not 
> continuously during the resize?  Releasing the mouse at the end of a 
> resize does not appear to send a mouseUp message.

Normal window resizing is handled by the OS, so doesn't generate mouse 
events.

One way to get close to what you request is to only relayout your 
objects if the user has not changed the size within a short period. 
Something like:
```
local sPendingResizeId
constant kResizeTimeout = 20

on resizeStack pWidth, pHeight
    /* If there is already a deferred request to resize then cancel. */
    if sPendingResizeId is not empty then
       cancel sPendingResizeId
    end if

    /* Defer the request to resize for a further period. */
    send "_doResizeStack pWidth, pHeight" to me in kResizeTimeout 
milliseconds
    put the result into sPendingResizeId
end resizeStack

on _doResizeStack pWidth, pHeight
    lock screen
    ... do relayout ...
    unlock screen
end _doResizeStack
```

This defers the relayout code until a resize stack message has not been 
sent for the timeout interval.

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things



More information about the use-livecode mailing list