Objective Grid: Filling a combobox

Article ID: 367
Last updated: 27 Apr, 2018
Article ID: 367
Last updated: 27 Apr, 2018
Revision: 3
Views: 2697
Posted: 19 Jan, 2001
by Meltreger B.
Updated: 27 Apr, 2018
by Meltreger B.

Problem

 


Can I use CWnd::DlgDirListComboBox() to fill a combobox in the grid?

 

 


Cause

 


 

 


Action

 


The following code:

pWnd->DlgDirListComboBox("c:\", GX_IDS_CTRL_CBS_DROPDOWNLIST,0, DDL_READWRITE);

fills up the combo box directly, but with CGXComboBox, the combo box will be filled up with the choice-list whenever you move to another cell (because different combo box cells in the grid share the same CComboBox window).

What you could do is loop through the added items after you call DlgDirListComboBox and fill up a choice list string which you can then pass to SetStyleRange().

Another idea would be that you register your own combo box control where you can then specify that the item list should not be reinitialized again when you move to another cell. This can be done with:

{
CGXComboBoxWnd* pWnd = new CGXComboBoxWnd(this, GX_IDS_CTRL_CBS_DROPDOWNLIST);

pWnd->Create(WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT, 0);

pWnd->m_bFillWithChoiceList = FALSE;

pWnd->DlgDirListComboBox("c:\", GX_IDS_CTRL_CBS_DROPDOWNLIST, 0, DDL_READWRITE);

RegisterControl(GX_IDS_CTRL_CBS_DROPDOWNLIST, pWnd);

}

This article was:   Helpful | Not helpful
Report an issue
Article ID: 367
Last updated: 27 Apr, 2018
Revision: 3
Views: 2697
Posted: 19 Jan, 2001 by Meltreger B.
Updated: 27 Apr, 2018 by Meltreger B.

Others in this category