# AccessKeyHandler

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

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

```rust
struct AccessKeyHandler
```

Handles access keys for a window.

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

## Members

- [`TYPE`](#assoc_const-type)
- [`access_key_event`](#function-access_key_event)
- [`access_key_pressed_event`](#function-access_key_pressed_event)
- [`show_access_key_property`](#function-show_access_key_property)
- [`new`](#function-new)
- [`registration_count`](#function-registration_count)
- [`registrations`](#function-registrations)
- [`set_owner_with`](#function-set_owner_with)
- [`on_preview_key_down`](#function-on_preview_key_down)
- [`on_key_down`](#function-on_key_down)
- [`on_preview_key_up`](#function-on_preview_key_up)
- [`on_preview_pointer_pressed`](#function-on_preview_pointer_pressed)
- [`process_key`](#function-process_key)

<a id="assoc_const-type"></a>

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this type.

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

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

### access_key_event

```rust
fn access_key_event() -> &'static RoutedEvent<AccessKeyEventArgs>
```

Defines the AccessKey event: raised on the element an access key
targets.

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

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

### access_key_pressed_event

```rust
fn access_key_pressed_event() -> &'static RoutedEvent<AccessKeyPressedEventArgs>
```

Defines the AccessKeyPressed event: raised to find the target of
an access key.

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

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

### show_access_key_property

```rust
fn show_access_key_property() -> &'static AttachedProperty<bool>
```

Defines the ShowAccessKey attached property: whether access key
markers are shown in a window.

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

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

### new

```rust
fn new() -> Rc<AccessKeyHandler>
```

Creates an access key handler without an owner.

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

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

### registration_count

```rust
fn registration_count(self: &Self) -> usize
```

The number of registered access keys, including registrations of
elements that are no longer alive and have not been purged yet.

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

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

### registrations

```rust
fn registrations(self: &Self) -> Vec<(String, crate::Ref<super::InputElement>)>
```

The registered access keys with the elements they target (the ones
that are still alive). For handlers built on this one.

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

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

### set_owner_with

```rust
fn set_owner_with(self: &Self, owner: &crate::Ref<super::InputElement>, on_set_owner: impl FnOnce(&crate::Ref<super::InputElement>) -> ())
```

Sets the owner of the handler as `IAccessKeyHandler::set_owner` does, with the key
and pointer handlers attached, and then runs `on_set_owner`: the `OnSetOwner` virtual
of the class, which does nothing in this class and which a handler built on this one
overrides (the handler of a menu item attaches its text input handler there).

This method can only be called once.

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

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

### on_preview_key_down

```rust
fn on_preview_key_down(self: &Self, e: &KeyEventArgs)
```

Called when a key is pressed in the owner window, before the event
reaches the focused element.

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

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

### on_key_down

```rust
fn on_key_down(self: &Self, e: &KeyEventArgs)
```

Called when a key is pressed in the owner window.

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

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

### on_preview_key_up

```rust
fn on_preview_key_up(self: &Self, e: &KeyEventArgs)
```

Handles the Alt/F10 keys being released in the window.

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

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

### on_preview_pointer_pressed

```rust
fn on_preview_pointer_pressed(self: &Self, _e: &PointerPressedEventArgs)
```

Handles a pointer press in the window: hides the access key markers.

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

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

### process_key

```rust
fn process_key(self: &Self, key: Option<&str>, element: Option<&crate::Ref<super::InputElement>>) -> bool
```

Processes an access key: raises the AccessKey event on the element
the key targets. Returns whether a target was found.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ErasedDestructor`
- `IntoEither`
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`IAccessKeyHandler`](/docs/0.5.0/api/ferroui-base/input/trait-iaccesskeyhandler/)
- [`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/).
