In order to catch the user escaping the button without making any choices this
works:
local lLabel
on mouseDown
put the label of me into lLabel
end mouseDown
on mouseLeave
if lLabel is not empty then
if label of me = lLabel then
answer "You did not select anything"
put empty into lLabel
end if
end if
end mouseLeave
> 12. apr. 2016 kl. 19.01 skrev Tore Nilsen <[email protected]>:
>
> When you do not select an item in the menu, pItemName is empty. If you set up
> a condition where the switch statement kicks in if pItemName is not empty,
> then you will get the result you wanted, also if the user leaves the menu
> without making any choice.
>
> Here is a script that demonstartes this:
>
> on menuPick pItemName
> if pItemName is not empty then
> answer pItemName
> else
> answer "You did not select anything"
> end if
> end menuPick
>
> Regards Tore
>
>
>
>> 12. apr. 2016 kl. 18.51 skrev Paul Dupuis <[email protected]>:
>>
>> I have a user interface problem. A popup menu (a button) is presented.
>> The button has a number of menu items, some dividers between items, etc.
>> It has a menuPick handler that covers all the items in the menu
>> explicitly and a default handler at the end (just for good measure).
>>
>> I want to take some action IF a user pops up the popup menu, but does
>> NOT select any menu item (so presses escape or clicks on a non-active
>> item like a menu divider or just click elsewhere so the popup is dismissed)
>>
>> The problem is, there appears to be NO message sent to the button of a
>> popup menu if NO active menu item is selected. The "default" switch
>> statement option never happens because a menuPick is never sent.
>> menuPick only get send when an active menu item is selected.
>>
>> A closeControl to the button when the popup menu is dismissed WOULD have
>> been another logical possibility but closeControl is only sent to groups
>> (according to the dictionary)
>>
>> Has any one else ever needed to take an action if a menu item is NOT
>> selected from a popup menu? Does anyone have any ideas on how this may
>> be handled? Should a message be sent to a popup menu button when the
>> popup menu is dismissed without a menuPick?
>>
>> If no message exists, should one? Should popup menus send a closeControl
>> to their button of dismissed without a menuPick? Should this be an
>> enhancement request for LiveCode version 1,936 (or earlier)? Why do I
>> run into these weird things?
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [email protected]
>> Please visit this url to subscribe, unsubscribe and manage your subscription
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> [email protected]
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode