Skip to content

UICanvas.SetFocus(IUIComponent) Method

Definition

Namespace: Brine2D.UI

Programmatically moves keyboard focus to component. The component must already be added to this canvas \(directly, or inside a [UIPanel](../UIPanel/index.md 'Brine2D\.UI\.UIPanel'), [UIScrollView](../UIScrollView/index.md 'Brine2D\.UI\.UIScrollView'), or [UITabContainer](../UITabContainer/index.md 'Brine2D\.UI\.UITabContainer')\) and must be a focusable type \([UIButton](../UIButton/index.md 'Brine2D\.UI\.UIButton'), [UICheckbox](../UICheckbox/index.md 'Brine2D\.UI\.UICheckbox'), [UISlider](../UISlider/index.md 'Brine2D\.UI\.UISlider'), [UIRadioButton](../UIRadioButton/index.md 'Brine2D\.UI\.UIRadioButton'), [UIDropdown](../UIDropdown/index.md 'Brine2D\.UI\.UIDropdown'), [UIScrollView](../UIScrollView/index.md 'Brine2D\.UI\.UIScrollView'), [UITabContainer](../UITabContainer/index.md 'Brine2D\.UI\.UITabContainer'), or [UITextInput](../UITextInput/index.md 'Brine2D\.UI\.UITextInput')\). Returns true when focus was applied, false if the component is not focusable, not enabled, or not visible.

C#
public bool SetFocus(Brine2D.UI.IUIComponent component);

Parameters

component IUIComponent

Returns

System.Boolean