Popup Menus

Bob Sneidar bobsneidar at iotecdigital.com
Wed Nov 3 16:42:43 EDT 2021

Hi all. This is a little difficult to explain. 

I have a popup menu. The first item in the text of the menu is "New Customer..." so that if I popup the menu then let go somewhere OUTSIDE the rect or the popped up items, menuPick is STILL triggered and the first item in the text of the popup button is the parameter passed to it. 

This means that even if a user clicks off a popped menu, the handler is still triggered. I think this is a bug, and popup menus ought not work that way, but neither here nor there. 

A workaround would be to detect if the mouseLoc was within the rect of the menu options that pop up when the menu is clicked, but alas the rect of the popup menu is only the size of the button, and does NOT include the options that appear when the button is clicked. 

Is there any way to get that rect? I suppose I could calculate it based on the max(<lines of the text>, <max visible lines>) given the line height and width of the button, but that is a bit of a kludge. 

Bob S

More information about the use-livecode mailing list