Understanding how the user navigates the tree with the keyboard.

Users can interact with the SRP Tree Control in a variety of ways using the keyboard. In addition to standard navigation, the SRP Tree Control supports keystroke find and tree modification.

Focus

When it comes to keyboard support, the concept of focus is essential. For a control to respond to keyboard input, it must be the control with keyboard focus. The SRP Tree Control is no different. Like all SRP OLE Controls, the SRP Tree Control will receive focus when the user tabs to it or clicks on it. If you need to programmatically set the focus, use the SRP Tree Control's Focus property, not the OpenInsight FOCUS property. Do this by using the OLE prefix:

Set_Property(@Window:".OLE_TREE", "OLE.Focus", Yes$)

In addition to the control having focus, there is also a single item that is the focus item. The focus item gives the user a sense of where they are. The focus item appears with a dotted rectangle surrounding it, unless the ShowFocusItem is 0. The FocusItem property can be used to get the item with focus or to programmatically move the focus to another item.

Standard Navigation

The SRP Tree Control supports the same keyboard navigation schema as the standard Windows tree control.

KeyNormal Action
+Expands the focus item
-Collapses the focus item
UpMoves to the item above
DownMoves to the item below
LeftIf expanded, just collapses the focus item. If collapsed, moves to focus item's parent.
RightIf expanded, moves to the focus item's first child. If collpsed, just expands the focus item.
PgUpMoves up one page.
PgDownMoves down one page.
HomeMoves to the top of the tree.
EndMoves to the bottom of the tree.
EnterFires a click event unless EnterBehavior is "None", in which case it moves focus to the next control.
TabMoves focus to the next control.
SpacebarToggles the selection in if hte SelectBehavior is set to "Toggle".

Note that when using the keys to navigate the tree, the selection moves to the new item. If the SelectBehavior property is set to "Multi", then the user can hold the SHIFT key while navigation to perform a span selection. If the SelectBehavior property is set to "Toggle", then only the focus moves when navigating, and the user must use the Spacebar to toggle the item's selection. In all cases, holding the CTRL key while navigating moves only the focus without disturbing the selection.

Keystroke Find

Moving around the tree control works well for exploring a tree, but sometimes users want to jump directly to an item they know exists. Keystroke find does this. As the user types alphanumeric characters, a substring is stored in memory. The focus jumps to first item that matches closest to the substring. As an example, let's say we have a tree listing all repository entities, and in there is an entity for the EMPLOYEES table. The user can type "emp" in sequence to jump directly to that item. As long as each key press occurs less than a second apart, the substring will grow. After a second has passed, the next keystroke begins a new substring and, therefore, a new search.

Note that keystroke finding is always enabled and will only locate items that are currently viewable. An item is viewable if it's parents are all expanded and it's ItemVisible and ItemEnabled properties are set to 1.

Modification

The SRP Tree Control provides you with the tools to implement modification, though it is not automated. It is not very often that users need to insert or delete items using the keyboard, but when the need arises, the OnModifyKey event can be captured. This event notifies you when the user has pressed the Insert or Delete keys. This gives you the opportunity to implement the appropriate logic, whether it's a simple removal of items or something must more complicated.

  • No labels