Skip to main content

Focus Management

  • 3 minutes to read

An end-user can move focus between layout items using the TAB key and shortcuts.

By default, the Layout Control’s Automatic Tab Order feature is enabled and the tab order defined by the TabIndex properties of the controls that constitute the layout is ignored. In this mode the layout control tracks the TAB key being pressed and moves focus according to its settings. When the Layout Control receives focus the top-, leftmost control is focused. When the TAB key is pressed focus is moved across and then down. So consistent focus movement is supported by default according to the visual order of the controls.

Shortcuts that can be added for layout items allow an end-user to quickly jump to a specific control. To specify a shortcut add the ampersand (‘&’) before a specific character in the layout item’s label (the BaseLayoutItem.Text property). An end-user can then press this character while holding the ALT key down to move focus to this layout item’s control.

Using Automatic Tab Order

The options that enable you to specify the sequence in which the controls are selected when an end-user presses the TAB key can be accessed via the layout control’s LayoutControl.OptionsFocus property. These options are described below in detail.

  • OptionsFocus.EnableAutoTabOrder

    This is the main option which enables the layout control’s Automatic Tab Order feature. If this option is set to false, the sequence in which the controls are selected when an end-user presses the TAB key is controlled by the form. For more information on how to set the tab order on Windows Forms, see “Setting the Tab Order on Windows Forms” concept in MSDN.

  • OptionsFocus.AllowFocusControlOnActivatedTabPage

    This option controls whether the top-left control is automatically focused after the tabbed page has been activated.

  • OptionsFocus.MoveFocusDirection

    This option specifies the direction in which the controls are selected when an end-user presses the TAB key. If it’s set to “AcrossThenDown”, the focus moves from one ‘row’ to another selecting each control in a row.

    If this option is set to “DownThenAcross”, the focus moves from one ‘column’ to another selecting each control in a column.

  • OptionsFocus.MoveFocusRightToLeft

    This option specifies the horizontal direction in which controls are selected when an end-user presses the TAB key. By default, this option is set to false. In this instance, controls are selected from left to right when an end-user presses the TAB key. Pressing the SHIFT+TAB keys moves the focus from right to left.

    Otherwise, if set to true, the direction in which controls are selected is inverted. In this instance, controls are selected from right to left when using the TAB key and, alternatively, from left to right if the SHIFT+TAB keys are used.

See Also