Menu Buttons

Bob Sneidar bobs at twft.com
Wed May 11 13:41:59 EDT 2011


Well what I do, as I said in a previous post, is I save the last successful choice in a property in the menu. Next time around I get the current selection and compare it to the last choice. If it's the same I exit menuPick. If it's not, then I process the handler, update the property, and pass menuPick. 

I do that because there is processing later on in the handler that I don't want to repeat. Other people's handlers it may not matter. If it does, this is the way to deal with it no matter which way the selection is made. 

Bob


On May 11, 2011, at 9:44 AM, Pete wrote:

> That's strange because that's not what I'm seeing - no wonder there's
> confusion!  Here's what I did to test.
> 
> Put an option menu on a card with the default choices.
> Put a menuPick handler on the option menu:
> on menuPIck pitemname
>    answer information pitemname
> end menuPick
> 
> Put a button on the same card with a mouseUp script:
> on mouseUp
>   set the menuHistory of button "Option Menu" to 2
> end mouseUp
> 
> First time I clicked the button, the answer information dialog appeared with
> "Choice 2" displayed.
> Second and subsequent times I clicked the button, no answer dialog was
> displayed.
> 
> I then changed the button script to set menu history to 1 and the answer
> information fired with "Choice 1" displayed.
> 
> It appears from other posts that the original problem is solved by using set
> the menuHistory so I guess this is somewhat academic but it would be good to
> establish whether this bug really has been fixed and if so, why I don't see
> the changed behavior, since I rely on that in some of my code.  Could it be
> platform related?  I'm running on OSX 10.6.7.
> 
> 
> Pete
> Molly's Revenge <http://www.mollysrevenge.com>
> 
> 
> 
> 
> On Tue, May 10, 2011 at 10:08 PM, Mark Wieder <mwieder at ahsoftware.net>wrote:
> 
>> Pete-
>> 
>> Tuesday, May 10, 2011, 8:40:34 PM, you wrote:
>> 
>>> Hmmm, well I just tried it and got no menuPick when I set the menuHistory
>> to
>>> its existing value (running 4.6.0.)
>> 
>> Here's the issue: setting the menuHistory of menu buttons would work,
>> but *only* if a new value was being set (not the same as the current
>> value). So the fix was to trigger the menuPick message when the
>> menuHistory command was issued irregardless of the current value of
>> the menu button.
>> 
>> That's working now. I just tried it again to make sure, with both
>> pulldown and option menus.
>> 
>> script of button 1:
>> on mouseDown
>> set the menuPick of button 3 to 2
>> end mouseDown
>> 
>> script of button 2:
>> on mouseDown
>> set the menuPick of button 4 to 2
>> end mouseDown
>> 
>> script of pulldown button 3:
>> on menuPick pChosen
>> switch pChosen
>>   default
>>     set the label of me to pChosen
>>     answer pChosen
>> end switch
>> end menuPick
>> 
>> script of option button 4:
>> on menuPick pChosen
>> switch pChosen
>>   default
>>     set the label of me to pChosen
>>     answer pChosen
>> end switch
>> end menuPick
>> 
>> Are you seeing something different?
>> 
>> --
>> -Mark Wieder
>> mwieder at ahsoftware.net
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list