Page 1 of 1

Palettising a main stack.

Posted: Thu Apr 25, 2024 4:41 pm
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

Re: Palettising a main stack.

Posted: Thu Apr 25, 2024 6:07 pm
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

Re: Palettising a main stack.

Posted: Thu Apr 25, 2024 8:13 pm
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

Re: Palettising a main stack.

Posted: Thu Apr 25, 2024 8:17 pm
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

Re: Palettising a main stack.

Posted: Thu Apr 25, 2024 8:19 pm
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

Re: Palettising a main stack.

Posted: Thu Apr 25, 2024 10:27 pm
by FourthWorld
Use the stack's style property and you'll need no code at all.

Re: Palettising a main stack.

Posted: Fri Apr 26, 2024 5:58 am
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

Re: Palettising a main stack.

Posted: Fri Apr 26, 2024 6:39 am
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.

Re: Palettising a main stack.

Posted: Fri Apr 26, 2024 6:42 am
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…

Re: Palettising a main stack.

Posted: Fri Apr 26, 2024 8:01 am
by FourthWorld
Yes, it's good to have options.