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 control cancel expanding or collapsing the item.  

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.

Syntax for BeforeExpandItem event, /NET version, on:

private void BeforeExpandItem(object sender,int Item,ref object Cancel)
{
}

Private Sub BeforeExpandItem(ByVal sender As System.Object,ByVal Item As Integer,ByRef Cancel As Object) Handles BeforeExpandItem
End Sub

Syntax for BeforeExpandItem event, /COM version, on:

private void BeforeExpandItem(object sender, AxEXTREELib._ITreeEvents_BeforeExpandItemEvent e)
{
}

void OnBeforeExpandItem(long Item,VARIANT FAR* Cancel)
{
}

void __fastcall BeforeExpandItem(TObject *Sender,Extreelib_tlb::HITEM Item,Variant * Cancel)
{
}

procedure BeforeExpandItem(ASender: TObject; Item : HITEM;var Cancel : OleVariant);
begin
end;

procedure BeforeExpandItem(sender: System.Object; e: AxEXTREELib._ITreeEvents_BeforeExpandItemEvent);
begin
end;

begin event BeforeExpandItem(long Item,any Cancel)
end event BeforeExpandItem

Private Sub BeforeExpandItem(ByVal sender As System.Object, ByVal e As AxEXTREELib._ITreeEvents_BeforeExpandItemEvent) Handles BeforeExpandItem
End Sub

Private Sub BeforeExpandItem(ByVal Item As EXTREELibCtl.HITEM,Cancel As Variant)
End Sub

Private Sub BeforeExpandItem(ByVal Item As Long,Cancel As Variant)
End Sub

LPARAMETERS Item,Cancel

PROCEDURE OnBeforeExpandItem(oTree,Item,Cancel)
RETURN

Syntax for BeforeExpandItem event, /COM version (others), on:

<SCRIPT EVENT="BeforeExpandItem(Item,Cancel)" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function BeforeExpandItem(Item,Cancel)
End Function
</SCRIPT>

Procedure OnComBeforeExpandItem HITEM llItem Variant llCancel
	Forward Send OnComBeforeExpandItem llItem llCancel
End_Procedure

METHOD OCX_BeforeExpandItem(Item,Cancel) CLASS MainDialog
RETURN NIL

void onEvent_BeforeExpandItem(int _Item,COMVariant /*variant*/ _Cancel)
{
}

function BeforeExpandItem as v (Item as OLE::Exontrol.Tree.1::HITEM,Cancel as A)
end function

function nativeObject_BeforeExpandItem(Item,Cancel)
return

The following VB sample cancels expanding or collapsing items:

Private Sub Tree1_BeforeExpandItem(ByVal Item As EXTREELibCtl.HITEM, Cancel As Variant)
    Cancel = True
End Sub

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

Private Sub Tree1_AfterExpandItem(ByVal Item As EXTREELibCtl.HITEM)
    Debug.Print "The " & Item & " item was " & IIf(Tree1.Items.ExpandItem(Item), "expanded", "collapsed")
End Sub

The following C# sample cancels expanding or collapsing items:

private void axTree1_BeforeExpandItem(object sender, AxEXTREELib._ITreeEvents_BeforeExpandItemEvent e)
{
	e.cancel = true;
}

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

Private Sub AxTree1_BeforeExpandItem(ByVal sender As Object, ByVal e As AxEXTREELib._ITreeEvents_BeforeExpandItemEvent) Handles AxTree1.BeforeExpandItem
    e.cancel = True
End Sub

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

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

The following VFP sample cancels expanding or collapsing items:

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

cancel = .t.


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