method Editor.AddItem (Value as Long, Caption as String, [Image as Variant])
Adds a new 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.  
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 ( DropDownListType editor ). 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. Call the Refresh method to update the editor's value, if it depends on a predefined list of items ( drop down editors ). Use the ItemToolTip property to assign a tooltip to the item.

The Caption property supports the following built-in HTML tags:

Newer HTML format supports subscript and superscript like follows:

Also, newer HTML format supports decorative text like follows:

 

The following VB sample adds some checks to a CheckListType editor:

With Record1
    .BeginUpdate
    With .Add("CheckListType", 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
        .Value = &H1 + &H2
    End With
    .EndUpdate
End With

The following VC sample add some checks to a CheckListType editor:

COleVariant vtMissing; vtMissing.vt = VT_ERROR;
CEditor editor = m_record.Add(COleVariant("CheckListType"), /*CheckListType*/ 6, vtMissing );
editor.AddItem( 0x01, "ReadOnly", vtMissing );
editor.AddItem( 0x02, "Hidden", vtMissing );
editor.AddItem( 0x04, "System", vtMissing );
editor.AddItem( 0x10, "Directory", vtMissing );
editor.AddItem( 0x20, "Archive", vtMissing );
editor.AddItem( 0x80, "Normal", vtMissing );
editor.AddItem( 0x100, "Temporary", vtMissing );
editor.SetValue( COleVariant( (long)(0x01 + 0x02) ) );
m_record.Refresh();

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