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 » Editable header cell in CExtGridWnd Collapse All
Subject Author Date
Vincent Wong Apr 23, 2007 - 4:30 AM

Hi,

Is there any way to create an editable header cell in a CExtGridWnd?

I am creating a grid that displays some data, and would like the user to be able to limit the data displayed by typing in a header cell in an appropriate column.

Using GridCellGetOuterAtTop() and an appropriate runtime class, I have been able to create various cell types in the header section of the grid, but they always come out disabled. I would prefer not to have to create the text entry cells as the first row of inner cells, as this would interfere with the sorting that currently works.

Is there perhaps a style flag that I need to set somewhere?

Thanks,

Vincent.

Vincent Wong Apr 24, 2007 - 2:03 AM

Hi,

Many thanks for the reply.

I discovered that I was already setting an appropriate flag - I have two rows of outer cells at the top, and was setting __EGWS_BSE_EDIT_CELLS_OUTER_T.

However, the cells were still not editable e.g. double-clicking on a CExtGridCellString cell in a header row did nothing. The problem appears to be in CExtGridBaseWnd::OnGbwBeginEdit(). The cells comes in with a nColType of 0 (inner) and a nRowType of -1 (outer). I don’t want the inner cells of the grid to be editable, so I also have the __EGWS_BSE_EDIT_CELLS_INNER flag set. As the column editable styles are checked before the row ones, the condition:

[ExtGridWnd.cpp: line 46868]
else if( nColType == 0 && (dwBseStyle&__EGWS_BSE_EDIT_CELLS_INNER) == 0L )
return false;

was true, causing the function to return without ever starting the edit.

Is this the intended behaviour? I have worked around the problem by overriding this function - editing now works.

Thanks,

Vincent.

Technical Support Apr 25, 2007 - 3:30 AM

Thank you for reporting this issue. Please replace the following piece of code at the beginning of the CExtGridWnd::OnGbwBeginEdit() method

DWORD dwBseStyle = BseGetStyle();
      if( nColType < 0 && (dwBseStyle&__EGWS_BSE_EDIT_CELLS_OUTER_L) == 0L )
            return false;
      else if( nColType > 0 && (dwBseStyle&__EGWS_BSE_EDIT_CELLS_OUTER_R) == 0L )
            return false;
      else if( nColType == 0 && (dwBseStyle&__EGWS_BSE_EDIT_CELLS_INNER) == 0L )
            return false;
      else if( nRowType < 0 && (dwBseStyle&__EGWS_BSE_EDIT_CELLS_OUTER_T) == 0L )
            return false;
      else if( nRowType > 0 && (dwBseStyle&__EGWS_BSE_EDIT_CELLS_OUTER_B) == 0L )
            return false;
      else if( nRowType == 0 && (dwBseStyle&__EGWS_BSE_EDIT_CELLS_INNER) == 0L )
            return false;
with this one
DWORD dwBseStyle = BseGetStyle();
      if(         nColType < 0
            &&    (dwBseStyle&__EGWS_BSE_EDIT_CELLS_OUTER_L) == 0L
            )
            return false;
      else if(    nColType > 0
            &&    (dwBseStyle&__EGWS_BSE_EDIT_CELLS_OUTER_R) == 0L
            )
            return false;
      else if(    nRowType < 0
            &&    (dwBseStyle&__EGWS_BSE_EDIT_CELLS_OUTER_T) == 0L
            )
            return false;
      else if(    nRowType > 0
            &&    (dwBseStyle&__EGWS_BSE_EDIT_CELLS_OUTER_B) == 0L
            )
            return false;
      else if(    nColType == 0
            &&    nRowType == 0
            &&    (dwBseStyle&__EGWS_BSE_EDIT_CELLS_INNER) == 0L
            )
            return false;
This should fix the problem.

Technical Support Apr 23, 2007 - 10:04 AM

There are several __EGWS_BSE_EDIT_CELLS_OUTER*** styles and style combinations defined in the ../Prof-UIS/Include/ExtGridWnd.h file. You can apply the needed styles by using the CExtGridWnd::BseModifyStyle() method so that a particular cell can be editable.