property Items.ExpandItem(Item as HITEM) as Boolean

Expands, or collapses, the child items of the specified item.

   Item as HITEM A long expression that indicates the handle of the item  being expanded or collapsed. If the Item is 0, setting the ExpandItem property expands or collapses all items. For instance, the ExpandItem(0) = False, collapses all items, while the ExpandItem(0) = True, expands all items.  
   Boolean A boolean expression that indicates whether the item is expanded or collapsed.  

Use ExpandItem property to programmatically expand or collapse an item. Use the ExpandItem property to check whether an items is expanded or collapsed. Before expanding/collapsing an item, the control fires the BeforeExpandItem event. Use the BeforeExpandIvent to cancel expanding/collapsing of an item. After item was expanded/collapsed the control fires the AfterExpandItem event. The following samples shows how to expand the selected item: G2antt1.Items.ExpandItem(G2antt1.Items.SelectedItem()) = True. The property has no effect if the item has no child items. To check if the item has child items you can use ChildCount property. Use the ItemHasChildren property to display a +/- expand sign to the item even if it doesn't contain child items. The ExpandOnSearch property specifies whether the control expands nodes when incremental searching is on ( AutoSearch property is different than 0 ) and user types characters when the control has the focus. Use the ExpandOnKeys property to specify whether the user expands or collapses the focused items using arrow keys. Use the InsertItem property to add child items.

The following VB sample programmatically expands the item when the user selects it :

Private Sub G2antt1_SelectionChanged()
    G2antt1.Items.ExpandItem(G2antt1.Items.SelectedItem()) = True
End Sub

The following VB sample expands programmatically the focused item:

With G2antt1.Items
    .ExpandItem(.FocusItem) = True
End With

The following C++ sample expands programmatically the focused item:

#include "Items.h"
CItems items = m_g2antt.GetItems();
items.SetExpandItem( items.GetFocusItem(), TRUE );

The following VB.NET sample expands programmatically the focused item:

AxG2antt1.Items.ExpandItem( AxG2antt1.Items.FocusItem ) = True

The following C# sample expands programmatically the focused item:

axG2antt1.Items.set_ExpandItem( axG2antt1.Items.FocusItem, true );

The following VFP sample expands programmatically the focused item:

with thisform.G2antt1.Items
	.DefaultItem = .FocusItem
	.ExpandItem( 0 ) = .t.


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