Hiding and Showing Pallettes

Andrew Kluthe andrew at ctech.me
Mon Oct 14 14:59:59 EDT 2013


Hey Ya'll,

I have a window that has "child windows" that are to be hidden when the
parent window is not the current focus, but need to float above the parent
window when the parent window is in focus.

I have tried leveraging suspend and resume to handle hiding and showing
these child palette windows and this works fine when minimizing and
restoring windows.

However, this fails when you click the title bar of another parent window.
the child palette windows just stay in view. There are other things I can
click get it to act like this as well.

Can anyone recommend a better way to do this? Below are my suspend and
resume handlers.

the childStacks property referred to below is simply a list of the stacks
the parent window has launched. It loops through them to see if they still
exist and hides or shows them if they do exist.

on suspendStack
   put "suspend"
   put the childStacks of me into sChildStacks
   put the mouseStack into sClickedStack
   if sClickedStack contains "load" or sClickedStack contains "scale" then
      exit suspendStack
   end if
   repeat for each line ChildStack in sChildStacks
      if ChildStack is among the lines of the OpenStacks then
         lock messages
         set the bottom of stack ChildStack to the bottom of this stack
         set the right of stack ChildStack to the right of this stack
         if the visible of stack ChildStack is true then
            hide stack ChildStack
         end if
         unlock messages
      end if
   end repeat
   pass suspendStack
end suspendStack


on resumeStack
   put "resume"
   put the childStacks of me into sChildStacks
   repeat for each line ChildStack in sChildStacks
      if ChildStack is among the lines of the OpenStacks then
         lock messages
         set the bottom of stack ChildStack to the bottom of this stack
         set the right of stack ChildStack to the right of this stack
         if the visible of stack ChildStack is false then
            show stack ChildStack
         end if
         unlock messages
      end if
   end repeat
   pass resumeStack
end resumeStack

-- 
Regards,

Andrew Kluthe
andrew at ctech.me



More information about the Use-livecode mailing list