Tech Support > Microsoft Windows > Development Resources > Popup Window that Behaves like Popup Menu
Popup Window that Behaves like Popup Menu
Posted by Jugoslav Dujic on November 6th, 2003


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

Posted by Pasi on November 6th, 2003


Jugoslav Dujic wrote:


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

Posted by Ralf Buschmann on November 6th, 2003


On Thu, 6 Nov 2003 09:59:04 +0100, "Jugoslav Dujic"
<jdujicREMOVE@uns.ns.ac.yu> wrote:

SetWindowsHookEx(WH_MOUSE, .... ?

Ralf.

Posted by Jugoslav Dujic on November 6th, 2003


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

Posted by Alex Blekhman on November 6th, 2003


"Jugoslav Dujic" <jdujicREMOVE@uns.ns.ac.yu> wrote in message
news:bod2gm$1cu8du$1@ID-106075.news.uni-berlin.de...
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.




Similar Posts