Opening stack as a palette

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
ibe
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 61
Joined: Sun Oct 04, 2009 12:15 pm

Opening stack as a palette

Post by ibe » Fri Aug 19, 2011 9:00 pm

I want my stack to open as a palette. I did a test stack where the only code was

Code: Select all

on preOpenStack
   palette this stack
   pass preOpenStack
end preOpenStack
no effect. It does get called so that's not the problem. Doesn't work with the openStack handler either. But if I call "palette stack "palette test"" in the Message Window it works. If I add a button with the same code, it works. But I want it to be a palette when it launches.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Opening stack as a palette

Post by mwieder » Fri Aug 19, 2011 10:05 pm

I've had trouble with that in a preOpenStack handler as well, but I've found that this works:

Code: Select all

set the style of this stack to "palette"

ibe
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 61
Joined: Sun Oct 04, 2009 12:15 pm

Re: Opening stack as a palette

Post by ibe » Fri Aug 19, 2011 10:21 pm

Thanks, just found it myself in an old forum thread. Works for me too. I wonder why the dictionary has nothing on this.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Opening stack as a palette

Post by dunbarx » Sat Aug 20, 2011 4:25 pm

It is a minor bug. If you write, in a top-level stack

Code: Select all

on mouseUp
   set the style of this stack to "palette"
   answer the style of this stack
end mouseUp
You get a palette, and the answer is "palette".

If you write

Code: Select all

on mouseUp
   palette this stack
   answer the style of this stack
end mouseUp
You get a palette, but the answer is "top-level".

Craig Newman
Last edited by dunbarx on Sun Aug 21, 2011 3:03 am, edited 1 time in total.

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am

Re: Opening stack as a palette

Post by marksmithhfx » Sun Aug 21, 2011 2:12 am

ibe wrote:Thanks, just found it myself in an old forum thread. Works for me too. I wonder why the dictionary has nothing on this.
What about adding a user contributed note?
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Opening stack as a palette

Post by jacque » Mon Aug 22, 2011 4:55 pm

The "palette" command is working correctly. The style of a stack is a permanent property and allows you to "go" to a stack, knowing it will always open as a palette (or whatever style is set.) The "palette" command will override the property setting on a one-time basis. If you use "palette myStack", the style property remains unchanged and if you just "go" to stack "myStack" later it will display in the original style again.

It's easier to see using the "toplevel" style. By default, all new stacks use style toplevel. You can display it differently on a case by case basis by issuing a command like "palette mystack", but the next time you close and then "go" to that stack it will display as toplevel again. If you ask about the style while it is showing on-screen as a palette, it will report "toplevel", because that's what it is.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Opening stack as a palette

Post by jacque » Mon Aug 22, 2011 5:01 pm

ibe wrote:I want my stack to open as a palette. I did a test stack where the only code was

Code: Select all

on preOpenStack
   palette this stack
   pass preOpenStack
end preOpenStack
no effect. It does get called so that's not the problem. Doesn't work with the openStack handler either. But if I call "palette stack "palette test"" in the Message Window it works. If I add a button with the same code, it works. But I want it to be a palette when it launches.
The stack window isn't drawn yet when preOpenStack triggers, so there is nothing onscreen to accomodate a command like "palette" -- which is a command to draw a window. That's why you need to set the style of the stack, so that when it is ready to display, it will display in the style you want.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply