GX_IDS_CTRL_TEXTFIT ComboBox wrong item selection if Formula Engine enabled

Article ID: 1289
Last updated: 16 Apr, 2018
Article ID: 1289
Last updated: 16 Apr, 2018
Revision: 3
Views: 1968
Posted: 19 Dec, 2007
by Meltreger B.
Updated: 16 Apr, 2018
by Meltreger B.

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;

}

 

This article was:   Helpful | Not helpful
Report an issue
Article ID: 1289
Last updated: 16 Apr, 2018
Revision: 3
Views: 1968
Posted: 19 Dec, 2007 by Meltreger B.
Updated: 16 Apr, 2018 by Meltreger B.

Others in this category