Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » CExtGridCellCheckBox and CExtGridCellComboBox cannot be operated with keyboard Collapse All
Subject Author Date
Nicholas Vezirgiannis Jul 1, 2009 - 6:58 AM

I have been using Prof-UIS v2.82 in MFC for some time now and I have a question regarding CExtGridCellCheckBox and CExtGridCellComboBox. I derived classes from those in order to be able to catch their events (OnInplaceControlCreate) and get therefore their data when changed. My problem is that the user cannot change the check box value using the keyboard. but can type next to it while I would like to prevent that. Regarding the ComboBox the user can type values even if they don’t exist in its list (which is wrong) and the event will not run to give me the data. The only way for the event to run is using the mouse.


My question is if there is a way to use with these controls both mouse and keyboard overcoming the problems above. Should I use a different event? Should derive them using some template I forgot?


The derived classes follow.




class DataGridCellCheckBox : public CExtGridCellCheckBox

{

public:

 DECLARE_SERIAL( DataGridCellCheckBox );

 IMPLEMENT_ExtGridCell_Clone( DataGridCellCheckBox, CExtGridCellCheckBox );

 DataGridCellCheckBox(CExtGridDataProvider *pDataProvider = NULL);

 ~DataGridCellCheckBox();


 virtual HWND DataGridCellCheckBox::OnInplaceControlCreate(

    CExtGridWnd & wndGrid, LONG nVisibleColNo, LONG nVisibleRowNo, LONG nColNo, LONG nRowNo,

    INT nColType, INT nRowType, const RECT & rcCellExtra, const RECT & rcCell,

    const RECT & rcInplaceControl, LONG nLastEditedColNo, LONG nLastEditedRowNo);


 /*virtual bool OnClick(CExtGridWnd & wndGrid, const CExtGridHitTestInfo & htInfo,

       UINT nChar, UINT nRepCnt, UINT nFlags);*/

};


//////////////////////////////////////////////////////////////////////////////////////////


class DataGridCellComboBox : public CExtGridCellComboBox

{

public:

 DECLARE_SERIAL( DataGridCellComboBox );

 IMPLEMENT_ExtGridCell_Clone( DataGridCellComboBox, CExtGridCellComboBox );

 DataGridCellComboBox(CExtGridDataProvider *pDataProvider = NULL);

 ~DataGridCellComboBox();


 virtual HWND DataGridCellComboBox::OnInplaceControlCreate(

    CExtGridWnd & wndGrid, LONG nVisibleColNo, LONG nVisibleRowNo, LONG nColNo, LONG nRowNo,

    INT nColType, INT nRowType, const RECT & rcCellExtra, const RECT & rcCell,

    const RECT & rcInplaceControl, LONG nLastEditedColNo, LONG nLastEditedRowNo);


};

Technical Support Jul 1, 2009 - 12:23 PM

The CExtGridCell class implements a generic grid cell which supports the check box, icon, up-down/drop-down/ellipsis buttons with pressing events, able to start editing cell’s text. All these features are present in all the other cell classes derived from it. The other grid cell classes are just improved version of it. Other cells containing different additional data, displaying different windows on drop-down/ellipsis button clicks, performing different enumeration algorithms on up-down button clicks, implementing different text editing limitations or even activating non-edit controls as in-place cell editing windows. Of course, other grid cell classes have additional methods and overrides. The <span class="newgreen">ProfUIS_Controls</code> sample application. The CExtGridCellCheckBox class simply uses check box feature available to any grid cell. But it adds an important additional feature: displaying different text depending on the check box state. The check box grid cell is not designed as editable. We think you should use the CExtGridCellString class and enable check box inside it by applying the __EGCS_CHK_CHECK grid cell style with the CExtGridCell::ModifyStyle method. The CExtGridCell::ModifyStyle method is virtual and you can override it for handling the check box changing state (the __EGCS_CHECKED style). The CExtGridCellComboBox class is the extended version of the CExtGridCellString class. It contains string array which is displayed in the popup list box shown on drop-down button click. The CExtGridCellComboBox::SetEnumMode method can be used for setting combo box cell to use the enumeration mode which does not allow to enter strings which are not present in string array. The enumeration mode also supports combo box selection changing on double click in its text editor. The combo box cell in the first of the ComboBox column in the <span class="newgreen">ProfUIS_Controls</code> sample application uses the enumeration mode. In any case, you should not implement custom in-place editor windows for grid cells. You can override the CExtGridCell::OnKey() and/or CExtGridCell::OnSysKey() virtual methods and implement checked state changing on specific keyboard keys pressing.