the visible of a stack

Dick Kriesel dick.kriesel at mail.com
Thu Sep 25 16:15:46 EDT 2008


Hi, Chipp.  Here's a version that's effectively the same but that has a
couple minor advantages.  First, it has a single exit point, possibly
improving maintainability.  Second, it executes the corner functions only
once no matter how many screens there are, possibly improving performance.

-- Dick

<script>
function isStackCurrentlyVisibleOnAnyMonitor pStack
    --> pStack IS THE SHORT NAME OF STACK
    put "false" into tResult
    if pStack is among the lines of windows() then
        if the visible of stack pStack then
            if the blendlevel of stack pStack < 100 then
                put the topleft of stack pStack into tTopLeft
                put the topright of stack pStack into tTopRight
                put the bottomleft of stack pStack into tBottomLeft
                put the bottomright of stack pStack into tBottomRight
                repeat for each line tScreenRect in the screenrects
                    if tTopLeft is within tScreenRect or \
                            tTopRight is within tScreenRect or \
                            tBottomLeft is within tScreenRect or \
                            tBottomRight is within tScreenRect then
                        put "true" into tResult
                        exit repeat
                    end if
                end repeat
            end if
        end if
    end if
    return tResult
end isStackCurrentlyVisibleOnAnyMonitor
</script>



On 9/25/08 12:46 PM, "Chipp Walters" <chipp at chipp.com> wrote:

> function isStackCurrentlyVisibleOnAnyMonitor pStack
>  --> pStack IS THE SHORT NAME OF STACK
>  if pStack is among the lines of windows() then
>    if not the vis of stack pStack then return false
>    if the blendlevel of stack pStack = 100 then return false
>    repeat for each line L in the screenrects
>       if the topLeft of stack pStack is within L then return true
>       if the topRight of stack pStack is within L then return true
>       if the bottomLeft of stack pStack is within L then return true
>       if the bottomRight of stack pStack is within L then return true
>    end repeat
>    return false
>  else
>    return false
>  end if
> end isStackCurrentlyVisibleOnAnyMonitor





More information about the use-livecode mailing list