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 » Hi, I have question about CExtGridWnd Collapse All
Subject Author Date
Cho jiyeon Jan 11, 2010 - 7:07 PM

Hi, Happy New years.


I can’t Enlglish, well..


I used CxtPPVW < CExtGridWnd > and connect ListCtrl.


So, CExtGridWnd is Datatype of ListCtrl


I want to have mouse click event.


Usually, Mouse event of ListCtrl have NM_Click or NM_DClick.


I want that When I click Grid, be showed clicked value of row or cloume by anoter Control .

Cho jiyeon Jan 18, 2010 - 3:19 AM

Thank you for your answer.


If when I get values of Grid, How is it?


When I cliked (1,1) of GridCell, I want get value (1,1) of GridCell.


Do I use Textget, member of CExtGridCellString?


 

Technical Support Jan 18, 2010 - 1:35 PM

The CExtGridCell::TextGet() and CExtGridCell::GetVariant() methods work for all the cell classes excepting cells like CExtGridCellPicture. So, you can get cell value as text or as VARIANT data structure. If your code knows cell type for particular grid columns and rows, then you can use the DYNAMIC_DOWNCAST preprocessor function provided by MFC for converting the CExtGridCell * pointer into required cell type pointer and then invoke specific methods.


Cho jiyeon Jan 18, 2010 - 3:21 AM

And Are nColType and nRowType number of Grid?

Technical Support Jan 18, 2010 - 1:35 PM

The nColType and nRowType parameters should have -1, 0 or 1 value.

The nColType is:
- -1 for outer header area at left
- 0 for inner data area
- 1 for outer header area at right

The nRowType is:
- -1 for outer header area at top
- 0 for inner data area
- 1 for outer header area at bottom

This means the grid control is split into 9 areas: one central data area and 8 outer header areas (left, right, top, bottom and 4 corner areas). The nColType and nRowType parameters specify the area inside the grid control. The nColNo and nRowNo parameters are zero based grid cell indices inside the specified grid area.



Technical Support Jan 13, 2010 - 11:08 AM

class CYourGrid : public CExtPPVW < CExtGridWnd >
{
public:
      virtual bool OnGbwAnalyzeCellMouseClickEvent(
            UINT nChar, // VK_LBUTTON, VK_RBUTTON or VK_MBUTTON only
            UINT nRepCnt, // 0 - button up, 1 - single click, 2 - double click, 3 - post single click & begin editing
            UINT nFlags, // mouse event flags
            CPoint point // mouse pointer in client coordinates
            )
      {
            ASSERT_VALID( this );
            if( nChar == VK_LBUTTON && nRepCnt == 1 )
            { // if single left button click
                  CExtGridHitTestInfo htInfo( point );
                  HitTest( htInfo, false, true );
                  if( ( ! htInfo.IsHoverEmpty() ) || htInfo.IsValidRect() )
                  { // if some grid cell is clicked,  not an empty area
                        INT nColType = htInfo.GetInnerOuterTypeOfColumn();
                        INT nRowType = htInfo.GetInnerOuterTypeOfRow();
                        if( nColType == 0 && nRowType == 0 )
                        { // if the clicked grid cell is the inner data cell, not header cell
                                    //
                                    //
                                    // Inner data cell is clicked. Its location is htInfo.m_nColNo column and htInfo.m_nRowNo row.
                                    // You can set focus to it using the FocusSet( CPoint( htInfo.m_nColNo, htInfo.m_nRowNo ) ); code.
                                    // You can check whether it’s selected using the SelectionGetForCell( htInfo.m_nColNo, htInfo.m_nRowNo ) code.
                                    // You can check which part of cell is clicked analyzing the htInfo properties.
                                    // You should return true if your code handles this click event.
                                    //
                                    //
                        } // if the clicked grid cell is the inner data cell, not header cell
                  } // if some grid cell is clicked, not an empty area
            } // if single left button click
            return CExtPPVW < CExtGridWnd > :: OnGbwAnalyzeCellMouseClickEvent( nChar, nRepCnt, nFlags, point );
      }
}

Cho jiyeon Jan 12, 2010 - 6:14 PM

Hmm, I don’t understand.


 


Do you have its exam?


 


If you are ok, Can you show its exam or how use it?

Cho jiyeon Jan 12, 2010 - 6:13 PM

Hmm, I don’t understand.


Do you have its exam?


If you are ok, Can you show its exam or how use it?

Technical Support Jan 12, 2010 - 6:29 AM

The CExtGridWnd control uses virtual methods rather than messages. You should override the CExtGridBaseWnd::OnGbwAnalyzeCellMouseClickEvent() virtual method to catch any mouse clicks in the grid control.