Does such a beast exist? (We are using VB). ie is there a
combo into which you can have two columns, one of which is
a check box?
[to those people who rightly ask "what will you display in the
text of the combo" I can only say that we will probably put the
word "multiple".]
Thanks.
Paul
email: pa...@pharos.co.nz
Try using a multiselect combo with owner-drawn style and drawing
the check box yourself (checked when selected, unchecked when
not selected).
--
Kent Tong (to...@archsci.arch.su.edu.au)
Team OS/2 new member
Key Center of Design Computing, Sydney University
>Hi
>We have a client who is determined to have a selectable list
>displayed using a drop down combo with check boxes. We currently
>use a multiselect in the drop down - but he is determined to have
>check boxes.
>Does such a beast exist? (We are using VB). ie is there a
>combo into which you can have two columns, one of which is
>a check box?
No, but you can easily simlulate this by using an owner-drawn
comboboxx. Instead of just rendering the string for each item,
you draw the checkbox bitmap (in the right state of course)
followed by the item text. You can get the standard checkbox
bitmaps using LoadBitmap(). You can create an owner-drawn
combobox by creating it the the CBS_OWNERDRAW or CBS_OWNERDRAWFIXED
styles. To perform the "owner-drawing" you must process the
WM_MEASUREITEM, WM_DRAWITEM and possibly the WM_DELETEITEM messages.
For simplicity, I would say that you should toggle the state of
the check box when you get a CBN_DBLCLK message for a given
item.
Or, you could subclass the combobox's listbox (remember a combo
box is actually more than one window) and intercept WM_LBUTTONDOWN,
etc. to see if the user is clicking directly on a checkbox bitmap
(to do this, you could start by sending the listbox LB_GETTOPINDEX
and LB_GETITEMRECT messages to do your hit-detection).
The problem here (and you might want to tell this to your client)
is that by putting checkboxes in a list, you are mixing two types
of user input. When the use clicks on an item, do you select it
(the default, "expected" behavior), toggle the checkbox (you have
to have some way to do this) or both??
An alternate to doing what your client wants is to use a popup menu
with checked menu items. Windows users already know how to use
checked menu items.
Changing the expected behavior of Windows only increases the likelyhood
that your program will confuse your users. And the last thing you want
to do is make things harder for your users, right?
Matt
Kent> In article <6694206.2...@kcbbs.gen.nz>, pa...@kcbbs.gen.nz
Kent> (Paul Reddy) writes:
Kent> |> Hi
Kent> |> We have a client who is determined to have a selectable list
Kent> |> displayed using a drop down combo with check boxes. We currently
Kent> |> use a multiselect in the drop down - but he is determined to have
Kent> |> check boxes.
Kent> |>
Kent> |> Does such a beast exist? (We are using VB). ie is there a
Kent> |> combo into which you can have two columns, one of which is
Kent> |> a check box?
Kent>
Kent> Try using a multiselect combo with owner-drawn style and drawing
Kent> the check box yourself (checked when selected, unchecked when not
Kent> selected).
Sorry to break into this conversation, but how exactly do you get a
multiselect drop-down combo. I thought that there was no such thing. Or is
it some VB custom control.
--
-----------
Paul B. Poh (pp...@iddis.com)
Software Development
IDD Information Services