Type | Description |
The DropDown method shows the drop down portion of the cell's editor. The DropDown method has effect only if the editor has a drop down portion. The following editors have a drop down portion: DropDownType, DropDownListType, CheckListType, DateType, ColorType, FontType, PictureType, PickEditType, ColorListType, MemoDropDownType or CalculatorType. Use the AddItem, InsertItem method to add predefined value. Use the RemoveItem method to remove a predefined value. Use the DropDownVisible property to hide the drop down button, if it exists.
The following VB sample shows the drop down portion of an editor as soon as a cell is focused:
Private Sub Grid1_FocusChanged() With Grid1 Dim i As Long i = .FocusColumnIndex With Grid1.Items If (.CellEditorVisible(.FocusItem, i)) Then Dim e As EXGRIDLibCtl.Editor Set e = Grid1.Columns(i).Editor If .HasCellEditor(.FocusItem, i) Then Set e = .CellEditor(.FocusItem, i) End If If Not e Is Nothing Then e.DropDown End If End If End With End With End Sub
The following C++ sample shows the drop down portion of an editor as soon as a cell is focused:
#include "Columns.h" #include "Column.h" #include "Editor.h" #include "Items.h" void OnFocusChangedGrid1() { if ( IsWindow( m_grid.m_hWnd ) ) { CItems items = m_grid.GetItems(); COleVariant vtMissing; V_VT( &vtMissing) = VT_ERROR; COleVariant vtFocusCell( items.GetItemCell( items.GetFocusItem(), COleVariant(m_grid.GetFocusColumnIndex()))); if ( m_grid.GetSelectColumnInner() > 0 ) vtFocusCell = items.GetInnerCell( vtMissing, vtFocusCell, COleVariant(m_grid.GetSelectColumnInner())); if ( items.GetCellEditorVisible( vtMissing, vtFocusCell ) ) { CEditor editor; if ( items.GetHasCellEditor( vtMissing, vtFocusCell ) ) editor = items.GetCellEditor( vtMissing, vtFocusCell ); else { CColumn column( m_grid.GetColumns().GetItem( COleVariant( m_grid.GetFocusColumnIndex() ) ) ); editor = column.GetEditor(); } if ( editor.m_lpDispatch != NULL ) editor.DropDown(); } } }
The following VB.NET sample shows the drop down portion of an editor as soon as a cell is focused:
Private Sub AxGrid1_FocusChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxGrid1.FocusChanged With AxGrid1.Items Dim focusCell As Object = .ItemCell(.FocusItem, AxGrid1.FocusColumnIndex) If (AxGrid1.SelectColumnInner > 0) Then focusCell = .InnerCell(Nothing, focusCell, AxGrid1.SelectColumnInner) End If If (.CellEditorVisible(, focusCell)) Then Dim ed As EXGRIDLib.Editor = AxGrid1.Columns(AxGrid1.FocusColumnIndex).Editor If (.HasCellEditor(, focusCell)) Then ed = .CellEditor(, focusCell) End If ed.DropDown() End If End With End Sub
The following C# sample shows the drop down portion of an editor as soon as a cell is focused:
private void axGrid1_FocusChanged(object sender, EventArgs e) { EXGRIDLib.Items items = axGrid1.Items; object focusCell = items.get_ItemCell(items.FocusItem, axGrid1.FocusColumnIndex); if ( axGrid1.SelectColumnInner > 0 ) focusCell = items.get_InnerCell( null, focusCell, axGrid1.SelectColumnInner ); if ( items.get_CellEditorVisible(null, focusCell )) { EXGRIDLib.Editor editor = axGrid1.Columns[axGrid1.FocusColumnIndex].Editor; if ( items.get_HasCellEditor(null, focusCell )) editor = items.get_CellEditor(null, focusCell ); if ( editor != null ) editor.DropDown(); } }
The following VFP sample shows the drop down portion of an editor as soon as a cell is focused:
*** ActiveX Control Event *** with thisform.Grid1.Items local ed ed = thisform.Grid1.Columns(thisform.Grid1.FocusColumnIndex).Editor if ( .HasCellEditor(.FocusItem, thisform.Grid1.FocusColumnIndex) ) ed = .CellEditor(.FocusItem, thisform.Grid1.FocusColumnIndex) endif ed.DropDown() endwith