Problems with custom Option Menu

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
palanolho
Posts: 122
Joined: Sat Apr 27, 2013 11:40 pm

Problems with custom Option Menu

Post by palanolho » Sun Feb 09, 2014 10:02 pm

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

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Problems with custom Option Menu

Post by bn » Mon Feb 10, 2014 2:45 am

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

palanolho
Posts: 122
Joined: Sat Apr 27, 2013 11:40 pm

Re: Problems with custom Option Menu

Post by palanolho » Mon Feb 10, 2014 9:27 am

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

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Problems with custom Option Menu

Post by bn » Mon Feb 10, 2014 10:38 am

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

palanolho
Posts: 122
Joined: Sat Apr 27, 2013 11:40 pm

Re: Problems with custom Option Menu

Post by palanolho » Mon Feb 10, 2014 10:32 pm

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

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

Re: Problems with custom Option Menu

Post by jacque » Tue Feb 11, 2014 6:52 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply