How can I fill the choice list of a combobox depending on a value in another cell?
You should override GetStyleRowCol and determine the choice list at runtime.
Example:
BOOL CMyGridyView::GetStyleRowCol(ROWCOL nRow, ROWCOL nCol, CGXStyle& style, GXModifyType mt, int nType)
{
if (!base_class::GetStyleRowCol(nRow, nCol, style, mt, nType))
return FALSE;
if (IsPrinting() || nRow == 0 || nType == -1)
return TRUE;
// you may also set this in your OnInitialUpdate routine!
m_bRefreshOnSetCurrentCell = TRUE;
// Check if this is the current cell
if (nCol == yourComboBoxCol && IsCurrentCell(nRow, nCol))
{
// execute a query which determines the choice only
// for the current cell. For inactive cells, the
// choice list has no meaning.
// current value of cell is available by calling style.GetValueRef()
// values of other cells are availabe with GetValueRowCol
style.SetChoiceList(szChoices);
}
return TRUE;
}