property G2antt.ExpandOnKeys as Boolean
Specifies a value that indicates whether the control expands or collapses a node when user presses arrow keys.

TypeDescription
Boolean A boolean expression that indicates whether the control expands or collapses a node when user presses arrow keys.
Use the ExpandOnKeys property to specify whether the control expands or collapses a node when user presses arrow keys. By default, the ExpandOnKeys property is True. Use the ExpandOnDblClick property to specify whether the control expands or collapses a node when user dbl clicks a node.  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. If the ExpandOnKeys property is False, the user can't expand or collapse the items using the + or - keys on the numeric keypad. Use the ExpandItem property to programmatically expand or collapse an item.

The following VB sample expands or collapses the focused item if the user presses the + or - keys on the numeric keypad, and  ExpandOnKeys property is False:

Private Sub G2antt1_KeyDown(KeyCode As Integer, Shift As Integer)
    With G2antt1.Items
        If (KeyCode = vbKeyAdd) Then
            .ExpandItem(.FocusItem) = True
        End If
        If (KeyCode = vbKeySubtract) Then
            .ExpandItem(.FocusItem) = False
        End If
    End With
End Sub

The following C++ sample expands or collapses the focused item if the user presses the + or - keys on the numeric keypad, and  ExpandOnKeys property is False:

#include "Items.h"
void OnKeyDownG2antt1(short FAR* KeyCode, short Shift) 
{
	CItems items = m_g2antt.GetItems();
	switch ( *KeyCode )
	{
		case VK_ADD:
		case VK_SUBTRACT:
		{
			items.SetExpandItem( items.GetFocusItem(), *KeyCode == VK_ADD ? TRUE : FALSE );
			break;
		}
	}
}

The following VB.NET sample expands or collapses the focused item if the user presses the + or - keys on the numeric keypad, and  ExpandOnKeys property is False:

Private Sub AxG2antt1_KeyDownEvent(ByVal sender As Object, ByVal e As AxEXG2ANTTLib._IG2anttEvents_KeyDownEvent) Handles AxG2antt1.KeyDownEvent
    Select Case (e.keyCode)
        Case Keys.Add
            With AxG2antt1.Items
                .ExpandItem(.FocusItem) = True
            End With
        Case Keys.Subtract
            With AxG2antt1.Items
                .ExpandItem(.FocusItem) = False
            End With
    End Select
End Sub

The following C# sample expands or collapses the focused item if the user presses the + or - keys on the numeric keypad, and  ExpandOnKeys property is False:

private void axG2antt1_KeyDownEvent(object sender, AxEXG2ANTTLib._IG2anttEvents_KeyDownEvent e)
{
	if ( ( e.keyCode == Convert.ToInt16(Keys.Add)  ) || (e.keyCode == Convert.ToInt16(Keys.Subtract) ) )
		axG2antt1.Items.set_ExpandItem( axG2antt1.Items.FocusItem, e.keyCode == Convert.ToInt16(Keys.Add) );
}

The following VFP sample expands or collapses the focused item if the user presses the + or - keys on the numeric keypad, and  ExpandOnKeys property is False:

*** ActiveX Control Event ***
LPARAMETERS keycode, shift

with thisform.G2antt1.Items
	if ( keycode = 107 )
		.DefaultItem = .FocusItem
		.ExpandItem(0) = .t.
	else
		if ( keycode = 109 )
			.ExpandItem(0) = .f.
		endif
	endif
endwith