Results 1 to 1 of 1

Thread: Tabbed Combo Box: Validation fails when choice list is changed dynamically

  1. #1
    Junior Member
    Join Date
    Sep 2017
    Islamabad, Pakistan

    Tabbed Combo Box: Validation fails when choice list is changed dynamically

    • 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: Visual Studio 2015, Stingray Studio 12.0

    It was working fine in Visual Studio 2008 with Stingray Studio 2004

    // Initialize tabbed combo box
    	.SetUserAttribute(GX_IDS_UA_TABLIST_KEYCOL, _T("1"))
    	.SetUserAttribute(GX_IDS_UA_TABLIST_TEXTCOL, _T("0"))
    	.SetUserAttribute(GX_IDS_UA_TABLIST_SHOWALLCOLS, _T("0"))
    // Change 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"));
    	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);
    	if (str.IsEmpty())
    		AfxMessageBox(_T("Please select a value from list."));
    	m_str[nRow-1] = str.Right(1);
    	return TRUE;
    Last edited by nasar; 09-14-2017 at 07:07 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts