Fired before an item is about to be expanded (collapsed).
Type | Description | |||
Item as HITEM | A long expression that indicates the handle of the item being expanded or collapsed. | |||
Cancel as Variant | (By Reference) 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 |
private void BeforeExpandItem(object sender, AxEXG2ANTTLib._IG2anttEvents_BeforeExpandItemEvent e) { } void OnBeforeExpandItem(long Item,VARIANT FAR* Cancel) { } void __fastcall BeforeExpandItem(TObject *Sender,Exg2anttlib_tlb::HITEM Item,Variant * Cancel) { } procedure BeforeExpandItem(ASender: TObject; Item : HITEM;var Cancel : OleVariant); begin end; procedure BeforeExpandItem(sender: System.Object; e: AxEXG2ANTTLib._IG2anttEvents_BeforeExpandItemEvent); begin end; begin event BeforeExpandItem(long Item,any Cancel) end event BeforeExpandItem Private Sub BeforeExpandItem(ByVal sender As System.Object, ByVal e As AxEXG2ANTTLib._IG2anttEvents_BeforeExpandItemEvent) Handles BeforeExpandItem End Sub Private Sub BeforeExpandItem(ByVal Item As EXG2ANTTLibCtl.HITEM,Cancel As Variant) End Sub Private Sub BeforeExpandItem(ByVal Item As Long,Cancel As Variant) End Sub LPARAMETERS Item,Cancel PROCEDURE OnBeforeExpandItem(oG2antt,Item,Cancel) RETURN |
<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.G2antt.1::HITEM,Cancel as A) end function function nativeObject_BeforeExpandItem(Item,Cancel) return |
The following VB sample cancels expanding or collapsing items:
Private Sub G2antt1_BeforeExpandItem(ByVal Item As EXG2ANTTLibCtl.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 G2antt1_AfterExpandItem(ByVal Item As EXG2ANTTLibCtl.HITEM) Debug.Print "The " & Item & " item was " & IIf(G2antt1.Items.ExpandItem(Item), "expanded", "collapsed") End Sub
The following C# sample cancels expanding or collapsing items:
private void axG2antt1_BeforeExpandItem(object sender, AxEXG2ANTTLib._IG2anttEvents_BeforeExpandItemEvent e) { e.cancel = true; }
The following VB.NET sample cancels expanding or collapsing items:
Private Sub AxG2antt1_BeforeExpandItem(ByVal sender As Object, ByVal e As AxEXG2ANTTLib._IG2anttEvents_BeforeExpandItemEvent) Handles AxG2antt1.BeforeExpandItem e.cancel = True End Sub
The following C++ sample cancels expanding or collapsing items:
void OnBeforeExpandItemG2antt1(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.