event AfterExpandItem (Item as HITEM)

Fired after an item is expanded (collapsed).

 TypeDescription 
   Item as HITEM A long expression that indicates the handle of the item being expanded or collapsed.  

The AfterExapndItem event notifies your application that an item is collapsed or expanded. Use the ExpandItem method to programmatically expand or collapse an item. The ExpandItem property also specifies whether an item is expand or collapsed. The ItemChild property retrieves the first child item. Use the BeforeExpandItem event to cancel expanding or collapsing items.

The following VB sample prints the item's state when it is expanded or collapsed:

Private Sub ComboBox1_AfterExpandItem(ByVal Item As EXCOMBOBOXLibCtl.HITEM)
    Debug.Print "The " & Item & " item was " & IIf(ComboBox1.Items.ExpandItem(Item), "expanded", "collapsed")
End Sub

The following C++ sample prints the item's state when it is expanded or collapsed:

void OnAfterExpandItemCombobox1(long Item) 
{
	if ( ::IsWindow( m_combobox.m_hWnd ) )
	{
		CItems items = m_combobox.GetItems();
		CString strFormat;
		strFormat.Format( "%s", items.GetExpandItem( Item ) ? "expanded" : "collapsed" );
		OutputDebugString( strFormat );	
	}
}

The following C# sample prints the item's state when it is expanded or collapsed:

private void axComboBox1_AfterExpandItem(object sender, AxEXCOMBOBOXLib._IComboBoxEvents_AfterExpandItemEvent e)
{
	System.Diagnostics.Debug.WriteLine(axComboBox1.Items.get_ExpandItem(e.item) ? "expanded" : "collapsed");
}

The following VB.NET sample prints the item's state when it is expanded or collapsed:

Private Sub AxComboBox1_AfterExpandItem(ByVal sender As Object, ByVal e As AxEXCOMBOBOXLib._IComboBoxEvents_AfterExpandItemEvent) Handles AxComboBox1.AfterExpandItem
    Debug.WriteLine(IIf(AxComboBox1.Items.ExpandItem(e.item), "expanded", "collapsed"))
End Sub

The following VFP sample sample prints the item's state when it is expanded or collapsed:

*** ActiveX Control Event ***
LPARAMETERS item

with thisform.ComboBox1.Items
	if ( .ExpandItem(item) )
		wait window "expanded" nowait
	else
		wait window "collapsed" nowait
	endif
endwith
 

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