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 » CExtGirdCellButton question Collapse All
Subject Author Date
tera tera Nov 7, 2008 - 9:33 PM

Hello.


When a button was pushed, I want to move a focus on this button.


 

Technical Support Nov 10, 2008 - 11:49 AM

The grid cells can have focused state. The built-in buttons inside grid cells cannot be focused.

tera tera Nov 10, 2008 - 9:44 PM

 


Hello.


When a grid is set by line selection ( __EGBS_SFM_FULL_ROWS  )

When I clicked a cell button, I want to move a cell


Technical Support Nov 11, 2008 - 9:12 AM

If your grid window uses the full-row selection model, any stand-alone grid cells cannot be focused nor selected. Please use the __EGBS_SFM_CELLS_HV style instead and add the following virtual methods to your grid class:

   virtual CRect & _SelectionAreaConvert( CRect & rcArea ) const
                {
                                ASSERT_VALID( this );
                                rcArea.left = 0;
                                rcArea.right = ColumnCountGet();
                                if( rcArea.right > 0 )
                                                rcArea.right --;
                                return rcArea;
                }

                virtual COLORREF OnGridCellQueryTextColor(
                                const CExtGridCell & _cell,
                                CDC & dc,
                                LONG nVisibleColNo,
                                LONG nVisibleRowNo,
                                LONG nColNo,
                                LONG nRowNo,
                                INT nColType,
                                INT nRowType,
                                DWORD dwAreaFlags,
                                DWORD dwHelperPaintFlags
                                ) const
                {
                                ASSERT_VALID( this );
                                COLORREF clrText =
                                                CExtGridWnd::OnGridCellQueryTextColor(
                                                                _cell,
                                                                dc,
                                                                nVisibleColNo,
                                                                nVisibleRowNo,
                                                                nColNo,
                                                                nRowNo,
                                                                nColType,
                                                                nRowType,
                                                                dwAreaFlags,
                                                                dwHelperPaintFlags
                                                                );
                                if( clrText != COLORREF(-1L) )
                                                return clrText;
                                if( (SiwGetStyle()&__EGBS_SFB_MASK) == __EGBS_SFB_CELLS )
                                {
                                                if( nColType == 0 && nRowType == 0 && nColNo >= 0 && nRowNo >= 0 )
                                                {
                                                                CPoint ptFocus = FocusGet();
                                                                if( ptFocus.x == nColNo && ptFocus.y == nRowNo )
                                                                                return OnSiwGetSysColor( COLOR_BTNTEXT );
                                                }
                                }
                                return COLORREF(-1L);
                }
                virtual bool OnGridHookCellPaintBackground(
                                const CExtGridCell & _cell,
                                CDC & dc,
                                LONG nVisibleColNo,
                                LONG nVisibleRowNo,
                                LONG nColNo,
                                LONG nRowNo,
                                INT nColType,
                                INT nRowType,
                                const RECT & rcCellExtra,
                                const RECT & rcCell,
                                const RECT & rcVisibleRange,
                                DWORD dwAreaFlags,
                                DWORD dwHelperPaintFlags
                                ) const
                {
                                ASSERT_VALID( this );
                                if( ( dwAreaFlags & __EGBWA_INNER_CELLS ) != 0 )
                                {
                                                CPoint ptFocus = FocusGet();
                                                if( ptFocus.x == nColNo && ptFocus.y == nRowNo )
                                                {
                                                                COLORREF clrAlternativeFocus1 =
                                                                                OnSiwGetSysColor( COLOR_HIGHLIGHT );
                                                                COLORREF clrAlternativeFocus2 =
                                                                                OnSiwGetSysColor( COLOR_WINDOW );
                                                                COLORREF clrAlternativeFocus =
                                                                                CExtPaintManager::stat_RGB_Enlight(
                                                                                                clrAlternativeFocus1,
                                                                                                clrAlternativeFocus2,
                                                                                                32
                                                                                                );
                                                                dc.FillSolidRect(
                                                                                &rcCell,
                                                                                clrAlternativeFocus
                                                                                );
                                                                return true;
                                                }
                                }
                                return
                                                CExtGridWnd::OnGridHookCellPaintBackground(
                                                                _cell,
                                                                dc,
                                                                nVisibleColNo,
                                                                nVisibleRowNo,
                                                                nColNo,
                                                                nRowNo,
                                                                nColType,
                                                                nRowType,
                                                                rcCellExtra,
                                                                rcCell,
                                                                rcVisibleRange,
                                                                dwAreaFlags,
                                                                dwHelperPaintFlags
                                                                );
                } 
As a result, your grid window will use the full-row selection and column based focus models.