event AddItem (Item as Item)
Occurs when a new item is added to a group.

 TypeDescription 
   Item as Item An Item object that's added to the Group's items collection.   

Use the AddItem event to notify your application that a new Item was added to Group. Use the Group property to find out the item's owner Group. The AddItem method fires the AddItem event each time when a new item was added to items Group collection. Use the SelectItem property to get the index of the selected item. Use the SelectGroup property to get the index of the selected group. Use the Add method to add new groups to the control. 

The following VB sample changes the item's alignment when a new items is added to the first group:

Private Sub ListBar1_AddItem(ByVal Item As EXLISTBARLibCtl.IItem)
    With Item
        If (.Group.Index = 0) Then
            .Alignment = exRight
        End If
    End With
End Sub

The following C++ sample changes the item's alignment when a new items is added to the first group:

void OnAddItemListbar1(LPDISPATCH Item) 
{
	CItem item( Item ); item.m_bAutoRelease = FALSE;
	if ( item.GetGroup().GetIndex() == 0 )
		item.SetAlignment( 2 /*exRight*/ );
}

The following VB.NET sample changes the item's alignment when a new items is added to the first group:

Private Sub AxListBar1_AddItem(ByVal sender As Object, ByVal e As AxEXLISTBARLib._IListBarEvents_AddItemEvent) Handles AxListBar1.AddItem
    With e.item
        If (.Group.Index = 0) Then
            .Alignment = EXLISTBARLib.AlignmentEnum.exRight
        End If
    End With
End Sub

The following C# sample changes the item's alignment when a new items is added to the first group:

private void axListBar1_AddItem(object sender, AxEXLISTBARLib._IListBarEvents_AddItemEvent e)
{
	if (e.item.Group.Index == 0)
		e.item.Alignment = EXLISTBARLib.AlignmentEnum.exRight;
}

The following VFP sample changes the item's alignment when a new items is added to the first group:

*** ActiveX Control Event ***
LPARAMETERS item

with item
	If (.Group.Index = 0) Then
		.Alignment = 2 && exRight
	EndIf
endwith

 

Private Sub ListBar1_AddItem(ByVal Item As EXLISTBARLibCtl.IItem)
    If (Item.Group.Index = 0) Then
        Item.Alignment = exRight
    End If
End Sub

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