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 General Discussion » CExtGridWnd Collapse All
Subject Author Date
Ahn Chul Hee May 26, 2006 - 12:24 AM

Hi

I know how to insert a check box in a grid cell.

All I want is inserting ’push button’ into a grid cell.

However, it seems that only ELLIPSIS button is supported.

I would be appriciate if you tell me the way to insert
push button into a grid cell or any sample code for it through the following email address.

Thank you. Have a nice day !!

Technical Support May 26, 2006 - 2:53 AM

Any grid cell supports three built-in buttons: up-down spin button, drop-down button and ellipsis button. Many grid cells perform event handling for these buttons and change their values. You should use the CExtGridCell::ModifyStyle() method for a particular grid cell and specify the following styles to enable a button for this cell: __EGCS_BUTTON_UPDOWN, __EGCS_BUTTON_DROPDOWN and/or __EGCS_BUTTON_ELLIPSIS. You can create your CExtGridCell-derived class and override the following virtual method to catch the button click event:

       virtual void OnButtonPressed(
              CExtGridWnd & wndGrid,
              INT nButtonType,
              const RECT & rcCellExtra,
              const RECT & rcCell,
              LONG nVisibleColNo,
              LONG nVisibleRowNo,
              LONG nColNo,
              LONG nRowNo,
              INT nColType,
              INT nRowType
              );
The nButtonType parameter can be equal to one of the following enumeration constants: CExtGridCell::__EBTT_UPDOWN_UP, CExtGridCell::__EBTT_UPDOWN_DOWN, CExtGridCell::__EBTT_DROPDOWN or CExtGridCell::__EBTT_ELLIPSIS. You can avoid coding your cell classes and handle the button clicks for all the grid cells in your CExtGridWnd-derived class which implements the following virtual method and which should return true if it handles the click event:
       virtual bool OnGridCellButtonPressed(
              CExtGridCell & _cell,
              INT nButtonType,
              const RECT & rcCellExtra,
              const RECT & rcCell,
              LONG nVisibleColNo,
              LONG nVisibleRowNo,
              LONG nColNo,
              LONG nRowNo,
              INT nColType,
              INT nRowType
              );
You need to code a CExtGridCell-derived class if you want to change the enabled state of cell buttons. In this case you should override the following virtual method:
       virtual bool OnQueryButtonInfo(
              INT nButtonType,
              bool * p_bEnabled,
              bool * p_bPressed = NULL,
              bool * p_bStayPressed = NULL,
              UINT * p_nTimerElapseValue = NULL
              ) const;
Using your CExtGridCell-derived class is also convenient to handle clicks on up and down parts of the spin button and update the enabled state of the up and down buttons independently from each other. This can be done by overriding the following methods:
       virtual bool OnQueryEnabledIncrement() const;
       virtual bool OnQueryEnabledDecrement() const;
       virtual bool OnValueIncrement();
       virtual bool OnValueDecrement();