Multi column Combo box (2)
First, I want to say, that I saw the article Multicolumn Combobox by Jakawan Ratiwanich, on www.codeguru.com. I inspected the piece of code, and I noticed that exist a array of items. That combo do not accept more than 200 items. In my mind, this is a inconvenient issue. So, I started to create a class CMultiColumnComboBox. Dealing with that very easy. The listbox of original combobox was replaced with a CListCtrl, so, when you will click in button's combo a lsitctrl will appear on the screen.
How user can use this control?
- Put in your resource dialog, a custom control, with window class name: MultiColumnComboBox.
- Add a new member in dialog class m_combo as CMultiColumnComboBox.
- In OnInitDialog subclass this member with
m_combo.SubclassDlgItem(IDC_CUSTOM1, this),
where IDC_CUSTOM1 is the ID of control in dialog.
How do you insert items?
Very easy. Here a snnipet code to insert:
CListCtrl* pList = m_combo.GetListCtrl(); // call this function to retieve the listcontrol inside.
pList->InsertColumn(0, _T("Col 1"), LVCFMT_LEFT, 48);
pList->InsertColumn(1, _T("Col 2"), LVCFMT_LEFT, 48);
...
As you see, filling control with items is in fact filling the list control. Now the control is ready to use.
Notes:
- If the use want to add checkboxes to the lis control, he can call the following function:
ListView_SetExtendedListViewStyle(m_combo.GetListCtrl()->m_hWnd,
LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES );
By default, the extended styles of listcontrol are : LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT.
If you need more help, free feel to ask me.

Comments
How to use it's list in virtual mode to show 60000+ items (Win98) ?
Posted by anand_study on 11/28/2006 08:18amThis is a very nice control. Thanks. Any one tried to use list control of this multi-column combo ? I need to use it's list in virtual mode to show 60000+ items (Win98) ? Thanks for any help/hint. Anand
ReplyList control with header
Posted by molostov on 06/29/2005 03:59pmIf list has header and the last item is selected, GetCurrentItem() returns -1.
ReplyProportionnal to Font Size? 2000 ?
Posted by Legacy on 10/16/2001 12:00amOriginally posted by: Michel DAVID
Hi Mihai.
I am interrested to know
1) Does it work on 2000/XP ?
2) Is it possible to make it higher (That means DY bigger) according to the Dialog font, like a regular CB that grows when the dialog font grows.
Thank you very much.
Michel DAVID
ReplyMARNET
a question
Posted by Legacy on 09/28/2001 12:00amOriginally posted by: Assia
i need some help for creating a combo Box which control the item of a second Dialog Box on the same dialog.
Unfortunatelly i hd an error occure for every try i made.
Can someone help me for that.
thank you in advance.
Assia from Paris
Replymouse wheel is not captured
Posted by Legacy on 07/03/2001 12:00amOriginally posted by: Ivaylo G.
Hi Mihai,
Thanks for control it is very practical!
But I find some small bug about mouse wheel. When I use it, that is not captured from control but for dialog window.
Can you give me some idea for that problem.
Ivailo
ReplyMinor bug in search
Posted by Legacy on 10/13/2000 12:00amOriginally posted by: Cesco
ReplyMinor bug in search
Posted by Legacy on 10/13/2000 12:00amOriginally posted by: Cesco
Replyi want this control!!
Posted by Legacy on 04/30/2000 12:00amOriginally posted by: Mark Axmann
I'm working on VB project that needs this control. How can I get a compiled .ocx of this control?? Or a VB code version.
ReplyThanks.
Mark
When in Combobox, Alt+F4 doesn't close the main window
Posted by Legacy on 06/10/1999 12:00amOriginally posted by: Magnus Johansson
When in the customized combobox, Alt+F4 doesn't close the main window.
Instead, it opens up the listbox.
Why is that ?
ReplyVery small change - Make it select EditBox contents when item selected:
Posted by Legacy on 06/02/1999 12:00amOriginally posted by: Bryan Napier
ReplyLoading, Please Wait ...