Page 1 of 1

Problems with custom Option Menu

Posted: Sun Feb 09, 2014 10:02 pm
by palanolho
Greetings everyone,

Since one of the last LC version updates (don't know which one) I'm having a problem with a custom Option menu I have created.

I have 4 stacks on my project:
- the Main stack
- the Working Stack
- the custom option menu drop-down stack
- and one last stack that I use as a code library

on my main stack, I have a on preOpenStack call that calls a function on one library stack
on the working stack, I have created a custom options menu that, instead of using normal options, uses a stack with all options on it (the option menu drop-down stack)

so, what's my problem?

This option menu was working just fine: I clicked on it, and the custom stack was displayed with the options to choose. However since one of the last updates, when I click on the option menu, the system is calling the on preOpenStack from the Main stack.

I have tried to create new option menus but it seems global now: If I use the option menu with normal options, it works, but if I try to use it with a custom stack, it call the Main stack on preOpenStack handler.


Anyone is able to provide any help?

thanks in advance,
- Miguel

Re: Problems with custom Option Menu

Posted: Mon Feb 10, 2014 2:45 am
by bn
Hi Miguel,
the custom option menu drop-down stack
it might be by invoking the option menu drop-down stack you trigger a preOpenStack message that is not handled in the substack and passes on to the main stack.

You might try to just put this in the substacks script:

Code: Select all

on preOpenStack
end preOpenStack
That would block a preOpenStack message to be passed to your mainstack.
Other than that I have on idea.

Kind regards
Bernd

Re: Problems with custom Option Menu

Posted: Mon Feb 10, 2014 9:27 am
by palanolho
Will try that and will let you know.

but this was working some time ago :( now, every time I open a new stack, the on preOpenStack handler from the Main is called.
this was not working like this before :(

Isn't this kinda like a bug ?

many thanks,
- Miguel

Re: Problems with custom Option Menu

Posted: Mon Feb 10, 2014 10:38 am
by bn
Hi Miguel,

It is unlikely to be a bug.

Do you have a "on preOpenStack" handler in your library?
That would explain why, if I understand correctly, the handler is triggers whenever you open a stack that is not part of your main/substack combo.

Kind regards
Bernd

Re: Problems with custom Option Menu

Posted: Mon Feb 10, 2014 10:32 pm
by palanolho
I tried to do as you said (add a "on preOpenStack" to all stacks) and it worked.

But this was definitely not working like this some time ago.... Don't know what have changed, but something changed ...

Thanks for the help
- Miguel

Re: Problems with custom Option Menu

Posted: Tue Feb 11, 2014 6:52 pm
by jacque
The behavior you saw has been part of LiveCode since the beginning, it is how the message hierarchy works, and is common to all the languages that preceded LiveCode too. So the most likely reason you saw a change was that there wasn't a preOpenStack handler in the message path before, and when one got added, it started to trigger.

Because all messages are passed to the next level if they aren't caught before that, a substack without a preOpenStack handler will pass the message to the main stack. The fix you've implemented just blocks the message from continuing on through the hierarchy.