| | | | Browse by category |
Problem
If a GX_IDS_CTRL_TEXTFIT ComboBox is used on a grid with the Formula Engine enabled, after activation of the drop down, the first item is always selected instead of the item that had previously been chosen.
Cause
If the choice list is "a b c" and item "b" is selected, text "b" is replaced with "'b" due to specifics of the Formula Grid, this causes the problem.
Action
The following trick fixes this problem:
BOOL C1stGridView::SetCurrentCell(ROWCOL nRow, ROWCOL nCol, UINT flags )
{
BOOL bret = CGXGridCore::SetCurrentCell( nRow, nCol, flags);
if(nRow==1 && nCol==1) // ComboBox in cell 1,1
{
CString str;
GetCurrentCellControl()->GetCurrentText(str);
GetCurrentCellControl()->SetCurrentText(str);
}
return bret;
}