Stack offscreen solution
Bob Sneidar
bobsneidar at iotecdigital.com
Wed Mar 30 12:04:52 EDT 2022
Hi all.
For those dealing with the stack appearing offscreen, here is a handy handler for moving the stack so that it is fully visible to the screen it belongs to. Note that the screen it belongs to is determined by the loc of the stack. Maybe this should be added to the Master Library?
Bob S
on setWindowInScreen pStackName
-- the stack rect
put the rect of stack pStackName into tStackRect
-- the rect of the screen the stack belongs to
put the screen of stack pStackName into tScreenNum
put line tScreenNum of the working screenrects into tScreenRect
-- is stack within the screenRect
-- Check for window off screen
IF item 1 of tStackRect < item 1 of tScreenRect THEN \
set the left of stack pStackName to item 1 of tScreenRect
IF item 2 of tStackRect < item 2 of tScreenRect THEN \
set the top of stack pStackName to (item 2 of tScreenRect + 42)
IF item 3 of tStackRect > item 3 of tScreenRect THEN \
set the right of stack pStackName to item 3 of tScreenRect
IF item 4 of tStackRect > item 4 of tScreenRect THEN \
set the bottom of stack pStackName to (item 4 of tScreenRect - 40)
-- the new screenRect
return the rect of stack pStackName
end setWindowInScreen
More information about the use-livecode
mailing list