# FocusChangingEventArgs

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/input/struct-focuschangingeventargs/

**struct** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
struct FocusChangingEventArgs
```

Provides data for focus changing: the `GettingFocus` and `LosingFocus`
events, which can cancel or redirect a focus change.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/focus_changing_event_args.rs#L10)

## Members

- [`old_focused_element`](#struct_field-old_focused_element)
- [`navigation_method`](#struct_field-navigation_method)
- [`key_modifiers`](#struct_field-key_modifiers)
- [`new`](#function-new)
- [`new_focused_element`](#function-new_focused_element)
- [`canceled`](#function-canceled)
- [`try_cancel`](#function-try_cancel)
- [`try_set_new_focused_element`](#function-try_set_new_focused_element)

<a id="struct_field-old_focused_element"></a>

### old_focused_element

```rust
old_focused_element: Option<crate::Ref<super::InputElement>>
```

The element that had focus before the change.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/focus_changing_event_args.rs#L17)

<a id="struct_field-navigation_method"></a>

### navigation_method

```rust
navigation_method: super::NavigationMethod
```

Indicates how the change in focus occurred.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/focus_changing_event_args.rs#L20)

<a id="struct_field-key_modifiers"></a>

### key_modifiers

```rust
key_modifiers: super::KeyModifiers
```

Any key modifiers active at the time of focus.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/focus_changing_event_args.rs#L23)

<a id="function-new"></a>

### new

```rust
fn new<T: ?Sized>(routed_event: &RoutedEvent<T>) -> Self
```

Creates args for a routed event.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/focus_changing_event_args.rs#L30)

<a id="function-new_focused_element"></a>

### new_focused_element

```rust
fn new_focused_element(self: &Self) -> Option<Ref<InputElement>>
```

The element that focus will move to.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/focus_changing_event_args.rs#L43)

<a id="function-canceled"></a>

### canceled

```rust
fn canceled(self: &Self) -> bool
```

Whether the focus change is canceled.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/focus_changing_event_args.rs#L53)

<a id="function-try_cancel"></a>

### try_cancel

```rust
fn try_cancel(self: &Self) -> bool
```

Attempts to cancel the current focus change. Returns true if the
focus change was cancelled; otherwise, false.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/focus_changing_event_args.rs#L59)

<a id="function-try_set_new_focused_element"></a>

### try_set_new_focused_element

```rust
fn try_set_new_focused_element(self: &Self, input_element: Option<&Ref<InputElement>>) -> bool
```

Attempts to redirect focus from the targeted element to the
specified element. Returns true if the focus change was redirected;
otherwise, false.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/focus_changing_event_args.rs#L67)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- `ToOwned`
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- `Deref`
- [`IRoutedEventArgs`](/docs/0.5.0/api/ferroui-base/interactivity/trait-iroutedeventargs/)
- [`IKeyModifiersEventArgs`](/docs/0.5.0/api/ferroui-base/input/trait-ikeymodifierseventargs/)
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
