Menu Builder

J. Landman Gay jacque at hyperactivesw.com
Thu Jan 12 14:43:17 EST 2012


On 1/12/12 1:01 PM, Pete wrote:

> There's more than one menu I have to dynamically adjust so I need to figure
> out in the group's mouseDown handler which menu was clicked.  I tried using
> the short name of me, the short name of the target, and the mouseControl
> but none of them tell me which button was clicked.  How do I figure that
> out?

I usually don't bother, though the "short name of the target" should 
work I'd think. I just set everything all at once. Some of my menu 
handlers are fairly long but they still run almost instantly. 
Manipulating menus is expensive, so it's a good idea to lock menus 
before changing things and then unlock menus at the end of the handler.

on mousedown
  lock menus
  put blahblah into btn "file" of me
  put somethingelse into btn "edit" of me
  unlock menus
end mousedown

>
> The other issue is what needs to be done for Windows.  I think I'm right in
> saying that the mouseDown event will reach the menu bar group if there is
> no mouseDown handler for the button itself - right?

Yes. Messages will pass through the hierarchy normally, so you get 
automatic cross-platform behavior.

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




More information about the use-livecode mailing list