property Editor.DropDownVisible as Boolean
Retrieves or sets a value that indicates whether the editor's drop down button is visible  or hidden.

 TypeDescription 
   Boolean A boolean value that indicates whether the editor's drop down button is visible  or hidden.  

Use the DropDownVisible property to hide the editor's drop-down button. Use the ButtonWidth property to hide the editor buttons. Use the AddItem, InsertItem method to add predefined values to the drop down list. Use the Refresh method update immediately the cell's content when adding new items to a drop down list editor. If the drop down button is hidden, the editor can't open its drop down portion if the user double clicks the editor, or presses the F4 key.

The following VB sample to check whether the editor's drop down portion is visible:

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Function isDropped()
    ' Specifies whether the control's drop down portion is visible or not
    isDropped = Not FindWindow("HostPopupWindow", "") = 0
End Function

The following VB sample advance to the next line when the ENTER key is pressed, and does the default action when an editor of drop down type is opened:

 Private Sub G2antt1_KeyDown(KeyCode As Integer, Shift As Integer)
    If (KeyCode = 13) Then
        If Not isDropped() Then
            KeyCode = vbKeyDown
        End If
    End If
End Sub

The following VB sample hides the drop down button:

With G2antt1.Items
    With .CellEditor(.FirstVisibleItem, 0)
        .EditType = EXG2ANTTLibCtl.DropDownListType
        .AddItem 0, "0 - <b>No</b>", 1
        .AddItem 1, "1 - <b>Yes</b>", 2
        .DropDownVisible = False
    End With
    .CellValue(.FirstVisibleItem, 0) = 1
    .CellValueFormat(.FirstVisibleItem, 0) = exHTML
End With

The following C++ sample hides the drop down button:

#include "Items.h"
#include "Editor.h"
COleVariant vtMissing; V_VT( &vtMissing) = VT_ERROR;
CItems items = m_g2antt.GetItems();
COleVariant vtItem( items.GetFirstVisibleItem() ), vtColumn( long(0) );
CEditor editor = items.GetCellEditor( vtItem, vtColumn );
editor.SetEditType( 3 /*DropDownListType*/ );
editor.AddItem( 0, "0 - <b>No</b>", vtMissing );
editor.AddItem( 1, "1- <b>Yes</b>", vtMissing );
editor.SetDropDownVisible( FALSE );
items.SetCellValue( vtItem, vtColumn, COleVariant( long(1)) );
items.SetCellValueFormat( vtItem, vtColumn, 1 /*exHTML*/ );

The following VB.NET sample hides the drop down button:

With AxG2antt1.Items
    With .CellEditor(.FirstVisibleItem, 0)
        .EditType = EXG2ANTTLib.EditTypeEnum.DropDownListType
        .AddItem(0, "0 - <b>No</b>", 1)
        .AddItem(1, "1 - <b>Yes</b>", 2)
        .DropDownVisible = False
    End With
    .CellValue(.FirstVisibleItem, 0) = 1
    .CellValueFormat(.FirstVisibleItem, 0) = EXG2ANTTLib.ValueFormatEnum.exHTML
End With

The following C# sample hides the drop down button:

EXG2ANTTLib.Items items = axG2antt1.Items;
EXG2ANTTLib.Editor editor = items.get_CellEditor(items.FirstVisibleItem, 0);
editor.EditType = EXG2ANTTLib.EditTypeEnum.DropDownListType ;
editor.AddItem(0, "0 - <b>No</b>", 1);
editor.AddItem(1, "1 - <b>Yes</b>", 1);
editor.DropDownVisible = false;
items.set_CellValue( items.FirstVisibleItem, 0, 1 );
items.set_CellValueFormat(items.FirstVisibleItem, 0, EXG2ANTTLib.ValueFormatEnum.exHTML);

The following VFP sample hides the drop down button:

with thisform.G2antt1.Items
	.DefaultItem = .FirstVisibleItem
	With .CellEditor(0, 0) 
		.EditType = 3 && DropDownListType
        .AddItem(0, "0 - <b>No</b>", 1)
        .AddItem(1, "1 - <b>Yes</b>", 2)
        .DropDownVisible = .f.
	EndWith
	.CellValue(0,0) = 1
	.CellValueFormat(0,0) = 1
endwith
 


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