event BeforeExpandItem (Item as HITEM, Cancel as Variant)

Fired before an item is about to be expanded (collapsed).

 TypeDescription 
   Item as HITEM A long expression that indicates the handle of the item being expanded or collapsed.  
   Cancel as Variant A boolean expression that indicates whether the user cancels the expanding/collapsing operation.  

The BeforeExpandItem event notifies your application that an item is about to be collapsed or expanded. Use the BeforeExpandItem event to cancel expanding or collapsing items. Use the BeforeExpandItem event to load new items when filling a virtual tree. The AfterExpandItem event is fired after an item is expanded or collapsed.  Use the ExpandItem method to programmatically expand or collapse an item. Use the ExpandOnSearch property to expand items while user types characters to search for items using incremental search feature.

The following VB sample cancels expanding or collapsing items:

Private Sub ComboBox1_BeforeExpandItem(ByVal Item As EXCOMBOBOXLibCtl.HITEM, Cancel As Variant)
    Cancel = True
End Sub

The following C++ sample cancels expanding or collapsing items:

void OnBeforeExpandItemCombobox1(long Item, VARIANT FAR* Cancel) 
{
	V_VT( Cancel ) = VT_BOOL;
	V_BOOL( Cancel ) = VARIANT_TRUE;	
}

The following C# sample cancels expanding or collapsing items:

private void axComboBox1_BeforeExpandItem(object sender, AxEXCOMBOBOXLib._IComboBoxEvents_BeforeExpandItemEvent e)
{
	e.cancel = true;
}

The following VB.NET sample cancels expanding or collapsing items:

Private Sub AxComboBox1_BeforeExpandItem(ByVal sender As Object, ByVal e As AxEXCOMBOBOXLib._IComboBoxEvents_BeforeExpandItemEvent) Handles AxComboBox1.BeforeExpandItem
    e.cancel = True
End Sub

The following VFP sample cancels expanding or collapsing items:

*** ActiveX Control Event ***
LPARAMETERS item, cancel

cancel = .t.


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