Click or drag to resize
DigitalRuneFocusManager Class
Controls which UI control has the focus.
Inheritance Hierarchy
SystemObject
  DigitalRune.Game.UIFocusManager

Namespace: DigitalRune.Game.UI
Assembly: DigitalRune.Game.UI (in DigitalRune.Game.UI.dll) Version: 1.8.0.0 (1.8.0.14553)
Syntax
public class FocusManager

The FocusManager type exposes the following members.

Constructors
  NameDescription
Public methodFocusManager
Initializes a new instance of the FocusManager class.
Top
Methods
  NameDescription
Public methodClearFocus
Removes the focus from the current FocusedControl.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodFocus
Moves focus to a control.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodOnMoveFocus
Called when the focus should be moved to another control.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Properties
  NameDescription
Public propertyFocusedControl
Gets the control that currently has the focus.
Public propertyFocusScope
Gets the focus scope that currently contains the focused control.
Public propertyScreen
Gets the screen.
Top
Remarks

The focus defines which control receives the device input. Controls must be Focusable to be able to get the focus.

Focus scopes handle the focus movement. A control is a FocusScope if IsFocusScope is set. Per default, only Windows are focus scopes. If a control is inside a focus scope is focused, the focus can be moved to another control of the same focus scope using the arrow keys on the keyboard, the left thumb stick or the DPad on the gamepad.

Each UIScreen has a FocusManager. It is allowed to exchange the focus manager instance. Derived focus manager classes can override OnMoveFocus(Boolean, Boolean, Boolean, Boolean, ListUIControl) to change how the focus moves.

Sometimes it is desirable to automatically move the focus to the control under the mouse, e.g. when the mouse moves over menu entries. For this FocusWhenMouseOver can be set for a control, e.g. for the control that represents the menu entry.

The UI control property AutoUnfocus can be set if the focus should be removed from the control (and its nested controls) if the user clicks onto the non-focusable space of the screen. AutoUnfocus is usually set for controls that are focus scopes or for the UIScreen.

See Also