FocusManager Class |
Namespace: DigitalRune.Game.UI
The FocusManager type exposes the following members.
Name | Description | |
---|---|---|
FocusManager |
Initializes a new instance of the FocusManager class.
|
Name | Description | |
---|---|---|
ClearFocus |
Removes the focus from the current FocusedControl.
| |
Equals | (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
Focus |
Moves focus to a control.
| |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
OnMoveFocus |
Called when the focus should be moved to another control.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
FocusedControl |
Gets the control that currently has the focus.
| |
FocusScope |
Gets the focus scope that currently contains the focused control.
| |
Screen |
Gets the screen.
|
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.