method Editor.InsertItem (Value as Long, Caption as String, [Image as Variant], [Parent as Variant])
Inserts a child item to the editor's list.

 TypeDescription 
   Value as Long A long expression that defines a predefined value.    
   Caption as String A string expression that indicates the caption for the Value. The Caption supports HTML format.  
   Image as Variant A long expression that indicates the index of the item's icon.  
   Parent as Variant A long expression that defines the value of the parent item.  
Use the InsertItem to insert child items to the editor's predefined list. Use the AddItem method to add new items to the editor's list. Use the ExpandItem property to expand an item. Use the ExpandAll items to expand all items. Use the ItemTooltip property to assign a tooltip to a predefined item into a drop down editor.

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 Grid1.Items
    With .CellEditor(.FirstVisibleItem, 0)
        .EditType = EXGRIDLibCtl.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_grid.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 AxGrid1.Items
    With .CellEditor(.FirstVisibleItem, 0)
        .EditType = EXGRIDLib.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:

EXGRIDLib.Items items = axGrid1.Items;
EXGRIDLib.Editor editor = items.get_CellEditor(items.FirstVisibleItem, 0);
editor.EditType = EXGRIDLib.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.Grid1.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-2008 Exontrol Inc, Software. All rights reserved.