Detecting popup menu cancelation

J. Landman Gay jacque at hyperactivesw.com
Sun Feb 28 13:11:23 EST 2010


Jeffrey Massung wrote:
> On Feb 28, 2010, at 11:21 AM, J. Landman Gay wrote:
> 
>> Jeffrey Massung wrote:
>>> I have a popup button that, when clicked, I change the background
>>>  color of a field so as to really highlight for the user exactly
>>> what their action is going to be taken on. However, currently, I
>>> have no way of detecting if the user chooses to do nothing
>>> (cancel the popup) and subsequently return the field's background
>>> color to its default. Is there some message I can key off of or
>>> some other way for me to accomplish this behavior?
>> Do you mean by "cancel" that the user slides off the menu without
>> selecting an option? If so, try "mouseRelease".
> 
> Yes, that's what I mean by "cancel." And no, mouseRelease doesn't
> work. Tried it. :-(

Oops, right, you're using a popup. Okay. In that case, the script waits 
until the menu is gone before continuing. So you don't need to know 
whether they selected anything or not, just deselect your object after 
the popup call. Like this:

on mousedown pBtn
   if pBtn = 3 then
     set the backcolor of me to "blue" -- or any object
     popup btn 1 at the mouseloc -- handler waits here till menu is gone
     set the backcolor of me to empty
   end if
end mousedown

In the popup button script, handle the menupick normally and ignore all 
the selection stuff.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list