Discussion:
Combobox in Listview.
(too old to reply)
Olav
2009-01-28 07:01:48 UTC
Permalink
Hello,

I have a listview - report style and *not* ownerdrawn,- in a DDT app, and
when a cell is clicked a combobox - *not* ownerdrawn - is created and shown
in the clicked cell.Works fine, but there exists a little problem. The list
portion of the combobox is not painted/drawn outside the listview control,
which has been set as the parent of the combobox.

What can be done to prevent this?

If I have to subclass one or both of the controls I know how to do that, but
have no clue to how to paint/draw the list portion outside its parent(the
listview).

Thank you for your attention!
--
Olav
Michael Mattias
2009-01-28 14:19:09 UTC
Permalink
Post by Olav
I have a listview - report style and *not* ownerdrawn,- in a DDT app, and
when a cell is clicked a combobox - *not* ownerdrawn - is created and
shown in the clicked cell.Works fine, but there exists a little problem.
The list portion of the combobox is not painted/drawn outside the listview
control, which has been set as the parent of the combobox.
As a rule, a child window will never be drawn outside its parent. (I am
assuming this is what you are doing, but code not shown). There may be a
way to tinker with the WS_CLIPxxxx styles of either/both the parent
(listview) and child (combobox) controls to allow this, but I am not sure
that can happen.

Or, you might try WS_OVERLAPPED style on the combobox. I'm not sure that
is allowed with a WS_CHILD style.

If the styles thing does not work out, the only solutions I can think of are
A) Don''t make the combobox a child of the listview, or B) owner-draw the
combobox.
--
Michael C. Mattias
Tal Systems Inc.
Racine WI
***@talsystems.com
Olav
2009-01-28 20:16:55 UTC
Permalink
Hello again,

Thanks you for your input. Problem solved now. I just replaced the
%CBS_SIMPLE style for the combo with %CBS_DROPDOWN.
Hard to understand why since I don't have a master grade on comboboxes. The
user now have to click the downarrow in the combo to open the list, but
that's okay.
--
Olav
Post by Michael Mattias
Post by Olav
I have a listview - report style and *not* ownerdrawn,- in a DDT app, and
when a cell is clicked a combobox - *not* ownerdrawn - is created and
shown in the clicked cell.Works fine, but there exists a little problem.
The list portion of the combobox is not painted/drawn outside the
listview control, which has been set as the parent of the combobox.
As a rule, a child window will never be drawn outside its parent. (I am
assuming this is what you are doing, but code not shown). There may be a
way to tinker with the WS_CLIPxxxx styles of either/both the parent
(listview) and child (combobox) controls to allow this, but I am not sure
that can happen.
Or, you might try WS_OVERLAPPED style on the combobox. I'm not sure that
is allowed with a WS_CHILD style.
If the styles thing does not work out, the only solutions I can think of
are A) Don''t make the combobox a child of the listview, or B) owner-draw
the combobox.
--
Michael C. Mattias
Tal Systems Inc.
Racine WI
Continue reading on narkive:
Loading...