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 » Possible problem with CExtGridCellComboBox in enum mode Collapse All
Subject Author Date
Mike Van Duzee Jan 12, 2006 - 6:21 AM

I have a grid cell with the CExtGridCellComboBox inserted and enum mode set to true. If the grid cell is empty (no value has been selected) and I call TextSet() with an invalid string (one not added to the combo box) the text in that cell will be changed, even though it is not a valid choice. But if the grid cell already has a value selected and I call TextSet() with an invalid string the cell is reset to be empty.

It would be nice if TextSet() worked the same in both cases.

Technical Support Jan 12, 2006 - 8:36 AM

Thank you for reporting this problem. Please add the lines marked with red to the CExtGridCellComboBox::TextSet() method and recompile the library:

void CExtGridCellComboBox::TextSet(
 __EXT_MFC_SAFE_LPCTSTR str, // = __EXT_MFC_SAFE_LPCTSTR(NULL) // empty text
 bool bAllowChangeDataType // = false
 )
{
 ASSERT_VALID( this );
 CExtGridCellString::TextSet( str, bAllowChangeDataType );
 if( ! GetEnumMode() )
  return;
LONG nNewCurSel =
  FindStringExact( str );
 if( nNewCurSel < 0 )
 {
  if( _tcscmp( str, _T("") ) != 0 )
   SetCurSel( -1, true );
  return;
 }
LONG nOldCurSel =
  GetCurSel();
 if( nNewCurSel == nOldCurSel )
  return;
 SetCurSel( nNewCurSel );
}
This will fix the issue.