Question about PopUp menu

If I have a PopUp menu on my window and I click out of the PopUp menu, the MenuItem returned is Nil.
OK.
But after managing this Nil the MouseDown event of the control is fired.
Is it a way to avoid this second part, that is, to avoid the MouseDown event being fired?
Thanks for any comment.

The user may click out of the menu intending to click somewhere else.

‘Ooops… I mean to click THERE…’

But if you want to prevent that, try a form-level variable
bWaitingForPopup as boolean

set it to true before the popup occurs.
Set it to false if the popup returns, regardless of whether the menuitem returned is nil.

In the Mousedown event, the first line of code can be

if bWaitingForPopup then exit function

And there may well be other ways to do it…

Thanks Jeff,

It’s very curious, but this is exactly what I have done.
I hoped that it was some “Return True or False” somewhere to avoid the MouseDown event, but it seems there is not. :slightly_frowning_face:

You’re talking about a contextual menu or popup menu?

It happens in both cases, I think.