Order of Multiple Stacks

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
EchoPointNZ
Posts: 1
Joined: Wed May 27, 2020 2:24 am

Order of Multiple Stacks

Post by EchoPointNZ » Tue May 11, 2021 2:02 am

Hi Team,

I'm using 3 Stacks, a Primary Stack which launches a Secondary Stack, that on occasion launches a 3rd, Extra stack. Problem being when the Secondary stack, launches the Extra stack. The Extra is put behind the Secondary, and I can't see it. Is there a way of controlling which stacks appear in front of others?

Thanks for any insight.
James

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Order of Multiple Stacks

Post by bogs » Tue May 11, 2021 10:50 am

Many, but it depends on what you want to happen ultimately.

If you want the 3rd stack to always be over the 2nd in display, 'palette stack 3' would probably be the way to go.

If you want the 3rd stack to always be over every other window regardless of where that window came from, make it a system window.

If you just want to have it initially over the window, just opening it and [go to stack "name"] should suffice.

I'd shy away from toplevel (unless you really want to make it the topLevel stack).

Lastly, you could always just set the topLeft of the extra stack to the topRight (or the reverse) of the 2nd stack, which would make it open to either side of the 2nd.
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9578
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Order of Multiple Stacks

Post by dunbarx » Tue May 11, 2021 2:41 pm

Hi,

I would not change the style of your stacks, but rather just manage the topLevel property. If you, as Bogs mentioned, set the topLevel, which does it no harm and gives it no "permanent" status, that stack will appear above all the others.

You may not be able to see a particular stack if it is buried, so clicking on it may not be a reliable option. You can write a short handler that can order your stacks. This is likely overkill, and seems silly, but may be instructive in its own right.

Make 3 stacks, and name them "x1", "x2" and "x3". In the script of, say, "x1":

Code: Select all

on mouseUp
   if the optionKey is down then
      answer "Set Layers?" with "123" or "132" or "231" or "213" or "312" or "321"
      repeat with y = 3 down to 1
         topLevel stack ("x" & char y of it)
      end repeat
   end if
end mouseUp
Now in the message box:

Code: Select all

insert the script of  stack "x1" into back
This allows any of the stacks (actually any other stack as well) to access this handler. Now hold the optionKey down and click on any stack. Select the order, and voila.

I told you it was silly.

Craig

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”