MenuItem.Popup Nil

With a Menuitem.Popup you get a Nil if you click none of the proposed menus. This is OK.
But is it possible to know where the user has clicked?

Possibly System.MouseX and System.MouseY, but you shouldn’t need to know. The user is clicking off the menu to close it, not to perform some other action. Additionally the user can close the menu by pressing Esc, so it’s not necessarily the result of a click.

My suggestion would be to simply ignore any action when you get a nil selection in this case.

I had to contact Apple to get a refund on an undesired purchase in the iTunes Music Store because of this kind of thing. (yes that long ago)

1 Like

Thank you Tim. Your answer is very inspiring. My problem is I am in a very complex application and probably there are some other bugs, but I need to know where the user clicked because my answer will depend on it.

can you explain “why” ? this would probably give a better answer.

Hi DerkJ, I’m sorry, but I don’t think I can explain many things.
In fact I have a button to create the MenuItem.Popup. When I click on it, it appears the menu and the button gets a different colour.
If the user clicks again the button I want to get the old colour for the button.
In my case, (I am sure there is another bug) the colour changed when I clicked down the mouse but the new colour reappeared when I left up the mouse.
Now I can calculate where the user clicked and do what I want and it works!
Sorry for my incompetence.

1 Like

If I get your intend right, I think the preferred way would be to have a timer (with mode=single and a period of 1) to reset the button. Enable the timer just before showing the menu; unless I’m not aware of a change, timers won’t execute while a menu is shown (but, of course, will after the menu closes).

Thanks Arnaud. Probably you are right.