| | | | Browse by category |
Problem
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?
Cause
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.
Action
So, what I recommend is:
Instead of using a random number, use the control ID that is also used in CGXStyle::SetControl().
Example:
// default edit box pControl = new CGXEditControl(pGrid, GX_IDS_CTRL_EDIT); break; // 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.