Re Pulldownmenu button bug on Windows

Richard Gaskin ambassador at fourthworld.com
Mon May 9 21:20:32 EDT 2022


Neville Smythe wrote:

 > My use-case was as follows. I have a pulldownmenu, not an application-
 > wide menu, which applied to only certain selected items in a field.
 > On mouseEnter, the selection changed colour, as a visual cue to the
 > user that these menu items could be applied to the selection. On
 > mouseLeave the colour changed back. At some point I inadvertently
 > added a line of code to the mouseLeave handler which had the effect
 > of killing the selection; this line was supposed to go into the
 > menuPick handler. On my Mac the app continued to work as intended,
 > but on a user's Windows PC the effect was to change a very minor
 > cosmetic difference into a major bug because the menu no longer
 > did anything. This was quite difficult to track down.

Thank you for that description.  Just to make sure I understand this, 
the menu button in question is on the card and does not appear in the 
menu bar, is that correct?

I think what you're seeing there is a side effect of the special 
handling LC uses for Mac menus, using OS routines rather than internal 
routines which emulate menus from temporary stacks. On Mac it seems the 
engine is suspending other mouse messages while it lets the OS handle 
the popped up menu, whereas on other platforms the normal mouseLeave is 
happening as soon as the mouse leaves the menu button.

At the moment the only solution I can think of is a bit kludgy, but 
seems to work:

Use stack menus on all platforms, with a timer to track when the menu 
stack has been closed.

It takes more to explain than to demonstrate, so here's a demo - feel 
free to ask any follow-up questions:

http://fourthworld.net/lc/MenuMessaging.livecode


If you want to make the stack menu look less kludgy you could embrace 
the kludge: add a preview pane or other elements that clearly show this 
is a non-standard menu, but in a good way. :)

I sometimes use stack menus for graphical pickers. They're kinda nice 
when you need 'em.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com



More information about the use-livecode mailing list