Mimic external click on popup menu

Do you know how in a pop-up menu, if you go beyond the menu, the pop-up window disappears? Well, I would like to reproduce this.

I currently have a panel created with some components when a button is clicked. The panel and accessories disappear when you press a specific button on the panel. However, I want it to go away if you click somewhere outside the panel.

+2
source share
1 answer

I think you will need to set the cover for the entire application, and if your panel is visible, and the coordinates of the mouse event are outside the borders of your panel, then hide the panel. Also process the WM_ACTIVATE message in your form.

[Edited: deleted response using SetCaptureControl (), because bahaviour is not suitable in this case)

+2
source

Source: https://habr.com/ru/post/1435113/


All Articles