property Editor.ExpandItem(Value as Variant) as Boolean
Expandes or collapses an item in the editor's list.

 TypeDescription 
   Value as Variant A long expression that indicates the value of the item being expanded, a string expression that indicates the caption of the item being expanded.  
   Boolean A boolean expression that indicates whether the item is expanded or collapsed.  

By default, the items in a drop down editor are collapsed. Use the ExpandItem to expand a specified item. Use the ExpandAll method to expand all items in the editor. Use the InsertItem method to insert a child item to your built-in editor.  Use the AddItem method to add new predefined values. Use the AddButton method to add a button to the editor. Use the DropDownAutoWidth property on False, when inserting predefined values as child items.

The following screen show shows a simple hierarchy into a built-in DropDownList editor:

The following VB sample adds a simple hierarchy to a DropDownList built-in editor:

The following VB samples adds a simple hierarchy to a PickEditType buil-in editor:

With G2antt1.Items
    With .CellEditor(.FirstVisibleItem, 0)
        .EditType = EXG2ANTTLibCtl.PickEditType
        .AddItem 0, "Organization"
        .InsertItem 1, "UN", , 0
        .InsertItem 2, "ONU", , 0
        .ExpandItem(0) = True
    End With
End With 

The following C++ sample adds a simple hierarchy to a PickEditType built-in editor:

#include "Items.h"
#include "Editor.h"
COleVariant vtMissing; V_VT( &vtMissing) = VT_ERROR;
CItems items = m_g2antt.GetItems();
CEditor editor = items.GetCellEditor( COleVariant( items.GetFirstVisibleItem() ), COleVariant( long(0) ) );
editor.SetEditType( 14 /*PickEditType*/ );
editor.AddItem( 0, "Organization", vtMissing );
editor.InsertItem( 1, "UN", vtMissing, COleVariant( long(0) ) );
editor.InsertItem( 2, "ONU", vtMissing, COleVariant( long(0) ) );
editor.SetExpandItem( COleVariant(long(0)), TRUE);

The following VB.NET sample adds a simple hierarchy to a DropDownListType built-in editor:

With AxG2antt1.Items
    With .CellEditor(.FirstVisibleItem, 0)
        .EditType = EXG2ANTTLib.EditTypeEnum.DropDownListType
        .AddItem(0, "Organization")
        .InsertItem(1, "UN", , 0)
        .InsertItem(2, "ONU", , 0)
        .ExpandItem(0) = True
    End With
End With

The following C# sample adds a simple hierarchy to a DropDownListType built-in editor:

EXG2ANTTLib.Items items = axG2antt1.Items;
EXG2ANTTLib.Editor editor = items.get_CellEditor(items.FirstVisibleItem, 0);
editor.EditType = EXG2ANTTLib.EditTypeEnum.DropDownListType;
editor.AddItem(0, "Organization", null);
editor.InsertItem(1, "UN",null,  0);
editor.InsertItem(2, "ONU",null, 0);
editor.set_ExpandItem(0, true);

The following VFP sample adds a simple hierarchy to a DropDownType built-in editor:

with thisform.G2antt1.Items
	With .CellEditor(.FirstVisibleItem, 0) 
		.EditType = 14 && PickEdiType
        .AddItem(0, "Organization")
        .InsertItem(1, "UN", , 0)
        .InsertItem(2, "ONU", , 0)
        .ExpandItem(0) = .t.
	EndWith
endwith
 


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