Keeping stacks on-screen

Richmond richmondmathewson at gmail.com
Mon Dec 26 11:10:42 CST 2011


Here's a fairly Quick-n-Dirty script which will
"do the magic" if pasted into the stack script
of any stack that is going wandering:

on moveStack
    put the short name of this stack into THSTK
     if the left of stack THSTK > (item 1 of the screenRect) then
       set loc of stack THSTK to the screenLoc
    end if
    if the top of stack THSTK > (item 2 of the screenRect) then
       set loc of stack THSTK to the screenLoc
    end if
    if the right of stack THSTK > (item 3 of the screenRect) then
       set loc of stack THSTK to the screenLoc
    end if
    if the bottom of stack THSTK > (item 4 of the screenRect) then
       set loc of stack THSTK to the screenLoc
    end if
end moveStack

on preOpenStack
    put the short name of this stack into THSTK
     if the left of stack THSTK > (item 1 of the screenRect) then
       set loc of stack THSTK to the screenLoc
    end if
    if the top of stack THSTK > (item 2 of the screenRect) then
       set loc of stack THSTK to the screenLoc
    end if
    if the right of stack THSTK > (item 3 of the screenRect) then
       set loc of stack THSTK to the screenLoc
    end if
    if the bottom of stack THSTK > (item 4 of the screenRect) then
       set loc of stack THSTK to the screenLoc
    end if
end preOpenStack


Not rocket science, but it does the trick.

Richmond.



More information about the use-livecode mailing list