CGXGridParam::SetSpecialMode
void SetSpecialMode(WORD wFlags);
wFlags
-
Specifies the options:
- GX_MODELBOX_SS specifies the usage as a single selection list box.
GX_MODELBOX_MS specifies the usage as multiple selection list box.
Remarks
Enables the specified special mode. Call this method for using the grid as single or multiple selection list box.
In single selection list box mode, setting the current cell always results in selecting the associated row.
In multiple selection list box mode, setting the current cell always results in selecting the associated row. If the user presses CTRL, he can select several rows. By pressing SHIFT, he can extend the last selection.
Note: You should also call SetHideCurrentCell(GX_HIDE_ALWAYS) to disable inverting the current cell. Also EnableSelection(GX_SELFULL) should be set or if you don't want column headers to be selectable call EnableSelection(GX_SELFULL&~GX_SELCOLS).
The following example shows you how to enable listbox-mode:
//////////////////////////////////////////////////////////////////
void CMyGridView::OnInitialUpdate( )
{
CGXRecordView::OnInitialUpdate( );
// Initialize default style
StandardStyle( )
.SetControl(GX_IDS_CTRL_STATIC);
SetReadOnly(TRUE);
// Initialization for listbox-mode
HideCols(0, 0);
CGXProperties* pProp = GetParam( )->GetProperties( );
pProp->SetDisplayHorzLines(FALSE);
pProp->SetDisplayVertLines(FALSE);
GetParam( )->SetActivateCellFlags(FALSE);
GetParam( )->EnableMoveCols(FALSE);
GetParam( )->EnableSelection(GX_SELFULL);
GetParam( )->SetSpecialMode(GX_MODELBOX_SS);
GetParam( )->SetHideCurrentCell(GX_HIDE_ALLWAYS);
// select first row
SetCurrentCell(1,0);
SelectRange(CGXRange( ).SetTable( ), FALSE);
SelectRange(CGXRange( ).SetRows(1), TRUE);
}
See Also
CGXGridParam::IsSpecialMode CGXGridParam::SetHideCurrentCell CGXGridParam::EnableSelection