News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

ListBox outside parent window

Started by Biterider, September 26, 2007, 05:54:28 AM

Previous topic - Next topic

Biterider

Hi
I'm running into troubles while building a new control in asm like a ComboBox and I need some help.
What I want to achieve is to have a ListBox like the ComboLBox has, that can extend outside of the parent window.
I found that the classic ComboBox uses the ComboLBox class and sets its parent to the desktop window. So far so good, but the problem is that I lost the focus of the parent window, unlike the behaviour of a regular ComboBox.
At this point I'm unsure if I have to return the focus to the original control and capture the mouse to finally send these messages to the ComboLBox...
If this is not the way to go I have no clue how MS arranged things to work nicely.
Any idea?

Regards,

Biterider

Tedd

Would it work better if you create the listbox with WS_EX_TOOLBAR style (in exstyle) and "WS_VISIBLE or WS_POPUP or WS_BORDER" (in the 'normal' style) - which would allow it to be a 'separate' window, but still a child of your main window?
No snowflake in an avalanche feels responsible.

Biterider

Hi Ted
Yes, you are right, the styles you mentioned are necessary to setup the pseudo child properly. Unfortunately, it doesnt solve the focus problem.
In the meantime I got the sourcecode of the ComboBox control from the ReactOS project. I'm reading it right now, but I can say that I wasn't too far away from this particular solution with my assumptions.

Regards,

Biterider

MichaelW

According to this the list captures the mouse when it is dropped down.
eschew obfuscation

Tedd

What's the focus problem then?
I would expect (I guess I should test it first ::)) with a toolwindow in focus, its parent should still have the indicated focus.
You can use WM_KILLFOCUS to find out which window you're main one is losing focus to (either your listbox, or another window); and possibly WM_ACTIVATE/ACTIVATEAPP will come in useful?
No snowflake in an avalanche feels responsible.

Biterider

Hi Tedd
Unfortunately the WS_EX_TOOLWINDOW style does not preserve the parent focus.

Biterider

Tedd

Okay, I've had a little play and... got nowhere :dazzled:
I see what you mean with toolwindow. It seems the window does need WS_CHILD, but then it's cropped to the parent.
And setting the parent to the desktop results in some weird effects. But if that's what the actual combobox does, then I suppose it's a matter of setting the correct styles and then fiddling the focus and capture ::)
No snowflake in an avalanche feels responsible.