MenuHistory bug?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
MenuHistory bug?
Took me a LONG time to find out why my code was not working.
When you set the menuHistory of an Option Menu button, a "menuPick" message is supposed to be sent to that button. But is is sent only if there is a change in the current menuHistory. In other words, if the menuHistory is already 3, setting that property to 3 will not send the message.
Feature? Bug? Something that everyone knows about?
Craig
When you set the menuHistory of an Option Menu button, a "menuPick" message is supposed to be sent to that button. But is is sent only if there is a change in the current menuHistory. In other words, if the menuHistory is already 3, setting that property to 3 will not send the message.
Feature? Bug? Something that everyone knows about?
Craig
Re: MenuHistory bug?
Not sure that's a bug...
menuHistory specifies the number of the currently selected item of the menu that belongs to a button.
if it's already set at the desired number, why would a message be sent?
If you really need this to trigger, why not set menuHistory to empty first, then set it to the desired number? That should then always trigger...
menuHistory specifies the number of the currently selected item of the menu that belongs to a button.
if it's already set at the desired number, why would a message be sent?
If you really need this to trigger, why not set menuHistory to empty first, then set it to the desired number? That should then always trigger...
Re: MenuHistory bug?
Stam.
I had no problem working around this, the very way you suggested. I was just wondering if it made any sense for LC NOT to send the message, however pointless it would be to set the menu to the very state it was already in. I mean, why bother to not send it? It assume it would make the engine just a tiny bit simpler. Could there be any actual reason?
Not an earth-shaking issue...
Craig
I had no problem working around this, the very way you suggested. I was just wondering if it made any sense for LC NOT to send the message, however pointless it would be to set the menu to the very state it was already in. I mean, why bother to not send it? It assume it would make the engine just a tiny bit simpler. Could there be any actual reason?
Not an earth-shaking issue...
Craig
-
- VIP Livecode Opensource Backer
- Posts: 10055
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: MenuHistory bug?
I had a conversation with Dr Raney about this back in the day. He reminded me that while pulldown menus are command inputs, option controls are selelectors. As such, he felt that any script triggered by a change in the selected item of an option control would only be redundant when there is no change.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: MenuHistory bug?
Richard.
Nope. Don't get that at all. Say I have an option menu with these menu items:
I just like to hear two beeps. It comforts me.
But if I select "B" because I just want to, I get no beeps. I am not certain I even invoked the menu properly, perhaps accidentally clicking badly or off screen. The message was not sent, because "B" was already selected. No comfort at all.
Wrong.
Craig
Nope. Don't get that at all. Say I have an option menu with these menu items:
with, say, "B" currently selected and displayed. In the button script:A
B
C
D
Code: Select all
on menuPick pItemName
beep 2
put pItemname into fld 1
end menuPick
But if I select "B" because I just want to, I get no beeps. I am not certain I even invoked the menu properly, perhaps accidentally clicking badly or off screen. The message was not sent, because "B" was already selected. No comfort at all.
Wrong.

Craig
Re: MenuHistory bug?
In other words, what possible advantage is there in not sending the message? Why not just let the normal process, er, proceed, regardless of whether or not anything changes inside the menu button? This actually threw me for a while in an app I was working on. I thought I had locked messages. I thought LC had frozen. I thought...
Craig
Craig
-
- VIP Livecode Opensource Backer
- Posts: 10055
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: MenuHistory bug?
I suppose it depends on how one defines "normal". Can you help me find examples where user interactions with other controls which don't change an option control label result in the option control providing feedback that no change occurred?
I may be overlooking a common scenario, but TBH I can't recall seeing that, and offhand I'm struggling to come up with a use case where I'd want to inform the user that nothing changed. But software design is a vast universe, so I'm eager to learn about cases where that can be useful.
All I know is that the docs describe menuHistory as only being sent when the value changes, much as closeField is only sent when the text of a field changes.
And similar to how exitField provides an alternate message to indicate leaving a field where text has had no change, in the less common case where you'd want to provide notification of no change occurring LC still provides a way to do that, by explicitly sending the message from the script of the control where the menuhistory is set.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: MenuHistory bug?
Richard.
Certainly I could:
And I appreciate and use the field "close" and "exit" options.
I suppose, apart from sheer pedantry (which you know from long experience with me I suffer from) I was just miffed that I spent time trying to figure out why a certain process was intermittently failing. This involved working with a number of option menus, and I kept getting hung up. It took a little while to realize that the hang occurred when there was no change to the particular option menu I accessed.
Thanks for all your help.
Craig
Certainly I could:
Code: Select all
send "menuPick B" to btn myOption
I suppose, apart from sheer pedantry (which you know from long experience with me I suffer from) I was just miffed that I spent time trying to figure out why a certain process was intermittently failing. This involved working with a number of option menus, and I kept getting hung up. It took a little while to realize that the hang occurred when there was no change to the particular option menu I accessed.
Thanks for all your help.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 10055
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: MenuHistory bug?
You just described much of my life.

Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn