Discussion:
Popup Window that Behaves like Popup Menu
(too old to reply)
Jugoslav Dujic
2003-11-06 08:59:04 UTC
Permalink
Usually, one sees the obvious when he tries to post a question
to a newsgroup... let me try :-).

I need to implement a popup window, containing few controls,
that will behave more or less like a popup menu -- opened by
a click, and closed by a click elsewhere. "Elsewhere" means
in any other window in the application, and there are quite
a few. I'm kinda out of ideas how to implement it simply:

- handling mouse down everywhere else looks inelegant to the
point of stupidity
- SetCapture is out, as it effectively disables child controls
within the popup window
- owner-drawn popup menu with child controls looks like a cludge
(and I'm not sure whether it's possible to place them there)

All ideas appreciated (no, I didn't get one in the meantime
:-( )
--
Jugoslav
___________
www.geocities.com/jdujic
Pasi
2003-11-06 09:43:18 UTC
Permalink
Post by Jugoslav Dujic
- SetCapture is out, as it effectively disables child controls
within the popup window
I guess you could use SetCapture and send mouse click messages to child
controls manually. i.e. On mouse click check whether mouse is over a
child window and if it is, pass the message to it.

-Pasi
Ralf Buschmann
2003-11-06 09:48:36 UTC
Permalink
On Thu, 6 Nov 2003 09:59:04 +0100, "Jugoslav Dujic"
Post by Jugoslav Dujic
Usually, one sees the obvious when he tries to post a question
to a newsgroup... let me try :-).
I need to implement a popup window, containing few controls,
that will behave more or less like a popup menu -- opened by
a click, and closed by a click elsewhere. "Elsewhere" means
in any other window in the application, and there are quite
a few.
SetWindowsHookEx(WH_MOUSE, .... ?

Ralf.
Jugoslav Dujic
2003-11-06 09:52:40 UTC
Permalink
Jugoslav Dujic wrote:
| Usually, one sees the obvious when he tries to post a question
| to a newsgroup... let me try :-).

Yep. The technique works.

The simple answer: handle WM_ACTIVATE(fActive = FALSE) &
hide the window or PostMessage a custom message to
the parent to do appropriate handling & cleanup.
--
Jugoslav
___________
www.geocities.com/jdujic
Alex Blekhman
2003-11-06 14:15:10 UTC
Permalink
Post by Jugoslav Dujic
Usually, one sees the obvious when he tries to post a question
to a newsgroup... let me try :-).
I need to implement a popup window, containing few controls,
that will behave more or less like a popup menu -- opened by
a click, and closed by a click elsewhere. "Elsewhere" means
in any other window in the application, and there are quite
- handling mouse down everywhere else looks inelegant to the
point of stupidity
- SetCapture is out, as it effectively disables child controls
within the popup window
- owner-drawn popup menu with child controls looks like a cludge
(and I'm not sure whether it's possible to place them there)
All ideas appreciated (no, I didn't get one in the meantime
:-( )
I think that SetCapture is the way. Just forward mouse click to child
window. And what about keyboard? Don't forget to handle ESC key to close
menu and Up/Down arrows to navigate menu items.

Loading...