|| | |||Browse by category|
Could you please tell me what those window IDs are used for that are passed to CGXEditControl::CreateControl() and the other CreateControl methods for the other cell types? Is there a problem if I use the same ID for multiple cell types?
99% of the time, this makes no difference because the grid is not using these window control IDs at all. But, I found that the control ID can be essential when you have owner-drawn combo boxes or list boxes because MFC will use the control ID to determine the combo box or list box object for calling OnDrawItem(), OnMeasureItem(), etc. (CGXTabbedComboBox and CGXTabbedComboBoxWnd are owner-drawn combo boxes and list boxes, for example).
Objective Grid itself ignores the control ID. When CGXGridCore::DoCtlColor() is called, only one cell (the current cell) can be active and fire notifications to the parent window. Therefore Objective Grid has no problems determining which window has sent that notification.
So, what I recommend is:
Instead of using a random number, use the control ID that is also used in CGXStyle::SetControl().
|// default edit box
pControl = new CGXEditControl(pGrid, GX_IDS_CTRL_EDIT);
// combobox allows user to input any text
// combobox uses an integer as cell value
With CGXComboBox, don't worry about using the same ID twice in the call to the constructor.