1
  • Initialize a tabbed combo box with a list. Let's call it "DefaultList".
  • Change the choice list in GetStyleRowCol or OnLoadCellStyle overridable functions. Let's call it "CustomList"
  • "CustomList" is displayed in combo box.
  • In OnValidateCell when try to get value from combo box. It always return empty. Actually the control has the older style object with "DefaultList".

The issue is that the control returned by GetControl(nRow, nCol) always has the initial style object with "DefaultList".

Environment: Stingray Studio 12.0 and Visual Studio 2015

it was working fine in VS 2008 with Stingray Studio 2004

// Initialize the combo box
m_grid1.SetStyleRange(CGXRange().SetCols(1),
    CGXStyle()
    .SetControl(GX_IDS_CTRL_CBS_TABBED_DROPDOWN)
    .SetChoiceList(_T("T00\t0\nT11\t1\nT22\t2\n"))
    .SetUserAttribute(GX_IDS_UA_TABLIST_KEYCOL, _T("1"))
    .SetUserAttribute(GX_IDS_UA_TABLIST_TEXTCOL, _T("0"))
    .SetUserAttribute(GX_IDS_UA_TABLIST_SHOWALLCOLS, _T("0"))
    .SetHorizontalAlignment(DT_LEFT)
);

// Change the combo box choice list
BOOL CSample2GridWnd::OnLoadCellStyle(ROWCOL nRow, ROWCOL nCol, CGXStyle & style, LPCTSTR pszExistingValue)
{
    if (nCol == 1)
    {
        if (pszExistingValue == NULL && nRow >= GetFirstRow() && !m_bNoValueNeeded)
        {
            style.SetChoiceList(_T("Test 0\t0\nTest 1\t1\nTest 2\t2\n"));
            style.SetValue(m_str[nRow-1]);
        }
    }

    CGXBrowserWnd::OnLoadCellStyle(nRow, nCol, style, pszExistingValue);

    return TRUE;
}

// validation routine
BOOL CSample2GridWnd::OnValidateCell(ROWCOL nRow, ROWCOL nCol)
{
    if (nCol != 1)
        return TRUE;

    CString str;

    // retrieve text from current cell
    CGXControl* pControl = GetControl(nRow, nCol);
    pControl->GetCurrentText(str);
    str.Trim();
    if (str.IsEmpty())
        AfxMessageBox(_T("Please select a value from list."));

    m_str[nRow-1] = str.Right(1);

    return TRUE;
}
Nasar
  • 11
  • 4
  • As it is a very specific question about a commercial library, you will propably have more success by asking roguewave support. Perhaps they have their own forum too? – zett42 Sep 08 '17 at 17:24
  • create a sample application and upload it to github so we can see more about the problem, but surely asking directly to roguewave is better as @zett42 said – Robson Sep 11 '17 at 16:14
  • Thanks @zett42. I have already posted this to relative forum. – Nasar Sep 14 '17 at 04:52

0 Answers0