If you click on a dividerLine in a popUp menu, the menuPick message fire, but 
with pItemName being empty. You can see this happen if you try:

on menuPick pItemName
answer pItemName
end menuPick

This will give you an empty dialog. At least this is what happens in LC 7.1.1

Tore


> 12. apr. 2016 kl. 21.36 skrev J. Landman Gay <jac...@hyperactivesw.com>:
> 
> The menupick message doesn't fire at all when no selection is made from a 
> popup button, but you do get a mouseLeave message. It might be possible to 
> track a local script variable to catch when that happens. This may need some 
> tweaking:
> 
> local sMenuItem
> 
> on menuPick pItemName
>  put pItemName into sMenuItem
>  switch pItemName
>    case "choice 1"
>      put "case 1"
>      break
>    case "choice 2"
>      put "case 2"
>      break
>    default
>  end switch
> end menuPick
> 
> on mouseLeave
>  if sMenuItem = "" then
>    doDefaultStuff
>  end if
>  put "" into sMenuItem
> end mouseLeave
> 
> on doDefaultStuff
>  put the seconds
> end doDefaultStuff
> 
> 
> On 4/12/2016 12:01 PM, Tore Nilsen wrote:
>> 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 <p...@researchware.com>:
>>> 
>>> 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
>>> use-livecode@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@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> 
> 
> -- 
> Jacqueline Landman Gay         |     jac...@hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to