method Editor.AddItem (Value as Long, Caption as String, [Image as Variant])
Adds a new item to editor's predefined 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.  

Use the AddItem method to add new items to the editor's predefined list. Use the InsertItem method to insert child items to the editor's predefined list. If the AddItem method uses a Value already defined, the old item is replaced. The AddItem method has effect for the following type of editors: DropDownType, DropDownListType, PickEditType, and CheckListType. Check each EditType value for what Value argument should contain. Use the RemoveItem method to remove a particular item from the predefined list. Use the ClearItems method to clear the entire list of predefined values. Use the SortItems to sort the items. Use the ItemToolTip property to assign a tooltip to a predefined item into a drop down list. Use the Refresh method update immediately the cell's content when adding new items to a drop down list editor. The Caption parameter supports HTML tags listed here here.  

The following VB sample adds items to a CheckListType editor:

With Grid1
    With .Columns.Add("CheckList").Editor
        .EditType = CheckListType
        .AddItem &H1, "ReadOnly", 1
        .AddItem &H2, "Hidden", 2
        .AddItem &H4, "System", 3
        .AddItem &H10, "Directory", 4
        .AddItem &H20, "Archive", 5
        .AddItem &H80, "Normal", 7
        .AddItem &H100, "Temporary", 8
    End With
.Items.AddItem &H1 + &H2
End With

The following VB sample adds predefined values to drop down list editor:

With Grid1.Items
    With .CellEditor(.FirstVisibleItem, 0)
        .EditType = DropDownListType
        .AddItem 0, "No border", 1
        .AddItem 1, "Single Border", 2
        .AddItem 2, "Double Border", 3
    End With
End With

The following C++ sample adds predefined values to drop down list editor:

With Grid1.Items
    With .CellEditor(.FirstVisibleItem, 0)
        .EditType = DropDownListType
        .AddItem 0, "No border", 1
        .AddItem 1, "Single Border", 2
        .AddItem 2, "Double Border", 3
    End With
End With

The following VB.NET sample adds predefined values to drop down list editor:

With AxGrid1.Items
    With .CellEditor(.FirstVisibleItem, 0)
        .EditType = EXGRIDLib.EditTypeEnum.DropDownListType
        .AddItem(0, "No border", 1)
        .AddItem(1, "Single Border", 2)
        .AddItem(2, "Double Border", 3)
    End With
End With

The following C# sample adds predefined values to drop down list editor:

EXGRIDLib.Items items = axGrid1.Items;
EXGRIDLib.Editor editor = items.get_CellEditor(items.FirstVisibleItem, 0);
editor.EditType = EXGRIDLib.EditTypeEnum.DropDownListType ;
editor.AddItem(0, "No border", 1);
editor.AddItem(1, "Single border", 2);
editor.AddItem(2, "Double border", 3);

The following VFP sample adds predefined values to drop down list editor:

with thisform.Grid1.Items
	With .CellEditor(.FirstVisibleItem, 0) 
		.EditType = 3 && DropDownList
        .AddItem(0, "No border", 1)
        .AddItem(1, "Single Border", 2)
        .AddItem(2, "Double Border", 3)
	EndWith
endwith

 


Send comments on this topic.
© 1999-2008 Exontrol Inc, Software. All rights reserved.