Palettising a main stack.

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: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10428
Joined: Fri Feb 19, 2010 10:17 am

Palettising a main stack.

Post by richmond62 »

I should like a main stack to appear as a palette, but this in the stack script does nothing:

Code: Select all

on openStack
palette me
end openStack
bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4219
Joined: Sun Jan 07, 2007 9:12 pm

Re: Palettising a main stack.

Post by bn »

richmond62 wrote: Thu Apr 25, 2024 4:41 pm I should like a main stack to appear as a palette, but this in the stack script does nothing:

Code: Select all

on openStack
palette me
end openStack
try:

Code: Select all

on openStack
   palette this stack
end openStack
Kind regards
Bernd
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10507
Joined: Wed May 06, 2009 2:28 pm

Re: Palettising a main stack.

Post by dunbarx »

Richmond.

"Me" really cannot be used that way. It only refers to the object that contains a running handler. So you could make this work if you put your original handler in the stack script.

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

Re: Palettising a main stack.

Post by dunbarx »

Well, more complicated than I thought.

If your handler is in the stack script, it does not work. But if it is this:

Code: Select all

on mouseUp
   palette me
end mouseUp
it work fine.

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

Re: Palettising a main stack.

Post by dunbarx »

Well, more complicated than I thought.

If your handler is in the stack script, it does not work. The openStack handler fires but nothing happens. But if it is this in the stack script:

Code: Select all

on mouseUp
   palette me
end mouseUp
it work fine if you click on the card window.

Craig
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Palettising a main stack.

Post by FourthWorld »

Use the stack's style property and you'll need no code at all.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
stam
Posts: 3214
Joined: Sun Jun 04, 2006 9:39 pm

Re: Palettising a main stack.

Post by stam »

dunbarx wrote: Thu Apr 25, 2024 8:19 pm Well, more complicated than I thought.

If your handler is in the stack script, it does not work. The openStack handler fires but nothing happens. But if it is this in the stack script:

Code: Select all

on mouseUp
   palette me
end mouseUp
it work fine if you click on the card window.

Craig
I’ve always used

Code: Select all

Set the style of this stack to “palette”
and it always works fine in preOpenStack
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Palettising a main stack.

Post by FourthWorld »

stam wrote: Fri Apr 26, 2024 5:58 am I’ve always used

Code: Select all

Set the style of this stack to “palette”
and it always works fine in preOpenStack
Best of all, the style property is persistent. Set it once, save it, and that's the mode it'll open in forever.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
stam
Posts: 3214
Joined: Sun Jun 04, 2006 9:39 pm

Re: Palettising a main stack.

Post by stam »

FourthWorld wrote: Fri Apr 26, 2024 6:39 am Best of all, the style property is persistent. Set it once, save it, and that's the mode it'll open in forever.

Sure.

However sometimes it’s of value to do this conditionally, especially especially when working on the stack.

For example, prefixing that statement with

Code: Select all

if the optionKey is not down then…
I just posted what code works for me. But sure, if no need to set this dynamically I just set this in the property inspector for the stack…
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Palettising a main stack.

Post by FourthWorld »

Yes, it's good to have options.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Post Reply