method Editor.DropDown ()
Displays the drop down list.

 TypeDescription 

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 G2antt1_FocusChanged()
    With G2antt1
        Dim i As Long
        i = .FocusColumnIndex
        With G2antt1.Items
            If (.CellEditorVisible(.FocusItem, i)) Then
                Dim e As EXG2ANTTLibCtl.Editor
                Set e = G2antt1.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 OnFocusChangedG2antt1() 
{
	if ( IsWindow( m_g2antt.m_hWnd ) ) 
	{
		CItems items = m_g2antt.GetItems();
		COleVariant vtMissing; V_VT( &vtMissing) = VT_ERROR;
		COleVariant vtFocusCell( items.GetItemCell( items.GetFocusItem(), COleVariant(m_g2antt.GetFocusColumnIndex())));
		if ( m_g2antt.GetSelectColumnInner() > 0 )
			vtFocusCell = items.GetInnerCell( vtMissing, vtFocusCell, COleVariant(m_g2antt.GetSelectColumnInner()));
		if ( items.GetCellEditorVisible( vtMissing, vtFocusCell ) )
		{
			CEditor editor;
			if ( items.GetHasCellEditor( vtMissing, vtFocusCell ) )
				editor = items.GetCellEditor( vtMissing, vtFocusCell );
			else
			{
				CColumn column( m_g2antt.GetColumns().GetItem( COleVariant( m_g2antt.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 AxG2antt1_FocusChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxG2antt1.FocusChanged
    With AxG2antt1.Items
        Dim focusCell As Object = .ItemCell(.FocusItem, AxG2antt1.FocusColumnIndex)
        If (AxG2antt1.SelectColumnInner > 0) Then
            focusCell = .InnerCell(Nothing, focusCell, AxG2antt1.SelectColumnInner)
        End If
        If (.CellEditorVisible(, focusCell)) Then
            Dim ed As EXG2ANTTLib.Editor = AxG2antt1.Columns(AxG2antt1.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 axG2antt1_FocusChanged(object sender, EventArgs e)
{
	EXG2ANTTLib.Items items = axG2antt1.Items;
	object focusCell = items.get_ItemCell(items.FocusItem, axG2antt1.FocusColumnIndex);
	if ( axG2antt1.SelectColumnInner > 0 )
		focusCell = items.get_InnerCell( null, focusCell, axG2antt1.SelectColumnInner );
	if ( items.get_CellEditorVisible(null, focusCell ))
	{
		EXG2ANTTLib.Editor editor = axG2antt1.Columns[axG2antt1.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.G2antt1.Items
	local ed
	ed = thisform.G2antt1.Columns(thisform.G2antt1.FocusColumnIndex).Editor
	if ( .HasCellEditor(.FocusItem, thisform.G2antt1.FocusColumnIndex) )
		ed = .CellEditor(.FocusItem, thisform.G2antt1.FocusColumnIndex)
	endif
	ed.DropDown()
endwith

 


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.