CGXComboBox::CGXComboBox

CGXComboBox(CGXGridCore* pGrid, UINT nEditID, UINT nListBoxID, UINT nFlags);

pGrid

Pointer to the parent grid.

nEditID

Specifies the edit control’s window ID.

nListBoxID

Specifies the drop-down list box’s window ID.

nFlags

Specifies the combo box type:

  • GXCOMBO_NOTEXTFIT: user can input any text

  • GXCOMBO_TEXTFIT: combo box adapts input text to an item in the drop-down list

  • GXCOMBO_ZEROBASED: cell value is a zero-based index

  • GXCOMBO_ONEBASED: cell value is a one-based index

  • GXCOMBO_DISPLAYCHOICE: use an integer index as cell value but display the entry from the choice list in the cell. This flag must be combined with either GXCOMBO_ONEBASED or GXCOMBO_ZEROBASED.

Remarks

Constructs a combo-box control object.

You need to register this object in the grid with CGXGridCore::RegisterControl before you can use it in cells (see example).

Example

This example shows how Objective Grid registers combo-box controls in the grid:

// Objective Grid Comboboxes (not derived from CComboBox)
// allow text input which fits the choice list
RegisterControl(GX_IDS_CTRL_TEXTFIT,
   new CGXComboBox(this, GX_IDS_CTRL_TEXTFIT, GX_IDS_CTRL_TEXTFIT+1, GXCOMBO_TEXTFIT));
// allow user to input any text
RegisterControl(GX_IDS_CTRL_COMBOBOX,
   new CGXComboBox(this, GX_IDS_CTRL_COMBOBOX, GX_IDS_CTRL_COMBOBOX+1, GXCOMBO_NOTEXTFIT));
// use an integer as cell value
RegisterControl(GX_IDS_CTRL_ONEBASED,
   new CGXComboBox(this, GX_IDS_CTRL_ONEBASED, GX_IDS_CTRL_ONEBASED+1, GXCOMBO_ONEBASED));
// use a zero-based integer as cell value
RegisterControl(GX_IDS_CTRL_ZEROBASED,
   new CGXComboBox(this, GX_IDS_CTRL_ZEROBASED, GX_IDS_CTRL_ZEROBASED+1, GXCOMBO_ZEROBASED));
// use an integer as cell value and display entry from list
RegisterControl(GX_IDS_CTRL_ONEBASED_EX,
   new CGXComboBox(this, GX_IDS_CTRL_ONEBASED_EX, GX_IDS_CTRL_ONEBASED_EX+1, GXCOMBO_ONEBASED|GXCOMBO_DISPLAYCHOICE));
// use a zero-based integer as cell value and display entry from list
RegisterControl(GX_IDS_CTRL_ZEROBASED_EX,
   new CGXComboBox(this, GX_IDS_CTRL_ZEROBASED_EX, GX_IDS_CTRL_ZEROBASED_EX+1, GXCOMBO_ZEROBASED|GXCOMBO_DISPLAYCHOICE));

See Also

 CGXGridCore::RegisterControl

CGXComboBox

 Class Overview |  Class Members