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 » How can I can the status of CExtGridCell checked or unchecked Collapse All
Subject Author Date
hansu chung Feb 3, 2005 - 1:15 AM

I can figureout which cell is checked but I have to know the whole rows checked status when one cell generate the checked event. is there any way to figure out which row is checked in the whole grid rows. please let me know ˆˆ


My source is like this


bool CXGridTextCell::OnClick(
  CExtGridWnd & wndGrid,
  const CExtGridHitTestInfo & htInfo,
  UINT nChar, // VK_LBUTTON, VK_RBUTTON or VK_MBUTTON only
  UINT nRepCnt, // 0 - button up, 1 - signle click, 2 - double click, 3 - post single click & begin editing
  UINT nFlags // mouse event flags
 )
{
 if( nChar == VK_LBUTTON && nRepCnt == 1 )
 { // if single left button click
  if( (nFlags&(MK_SHIFT|MK_CONTROL)) == 0 )
  { // if neither Shift nor Ctrl keys was pressed
   if( (htInfo.m_dwAreaFlags&__EGBWA_CELL_CHECKBOX) == 0 )
   {
...   } // if( (htInfo.m_dwAreaFlags&__EGBWA_CELL_CHECKBOX) == 0 )
   else


   {
    CString sProductNo;
    CExtGridCell* cGridCell;


   int nRowCount;
    nRowCount = ((CXGridCtrl*)&wndGrid)->m_nRowCount;
    for (int i = 0;i < nRowCount; i++)
    {
     cGridCell = (CXGridTextCell*)wndGrid.GridCellGet(0, i);
     
     DWORD dwCellStyle = cGridCell->GetStyle();
     if( ((dwCellStyle&__EGCS_CHECKED) != 0))
      cGridCell->TextGet(sProductNo);
    }


   }//Ckeckbox Clicked


...

Technical Support Feb 3, 2005 - 5:33 AM

The CExtGridCell::OnClick() virtual method has the constant CExtGridHitTestInfo & htInfo parameter that completely describes the location of the cell being clicked and even which part of the cell is hovered by the mouse pointer (check box, button, text area and etc). You need to use htInfo.m_nColNo and htInfo.m_nRowNo as cell coordinates.