# SelectableTextBlock

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/struct-selectabletextblock/

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

```rust
struct SelectableTextBlock
```

A control that displays a block of formatted text whose content can be
selected and copied.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L34)

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`selection_start_property`](#function-selection_start_property)
- [`selection_end_property`](#function-selection_end_property)
- [`selected_text_property`](#function-selected_text_property)
- [`selection_brush_property`](#function-selection_brush_property)
- [`selection_foreground_brush_property`](#function-selection_foreground_brush_property)
- [`can_copy_property`](#function-can_copy_property)
- [`copying_to_clipboard_event`](#function-copying_to_clipboard_event)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`copying_to_clipboard`](#function-copying_to_clipboard)
- [`selection_brush`](#function-selection_brush)
- [`set_selection_brush`](#function-set_selection_brush)
- [`selection_foreground_brush`](#function-selection_foreground_brush)
- [`set_selection_foreground_brush`](#function-set_selection_foreground_brush)
- [`selection_start`](#function-selection_start)
- [`set_selection_start`](#function-set_selection_start)
- [`selection_end`](#function-selection_end)
- [`set_selection_end`](#function-set_selection_end)
- [`selected_text`](#function-selected_text)
- [`can_copy`](#function-can_copy)
- [`copy`](#function-copy)
- [`select_all`](#function-select_all)
- [`clear_selection`](#function-clear_selection)

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

### TYPE

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

The runtime type of this class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L46)

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

### to_ref

```rust
fn to_ref(self: &Self) -> $crate::Ref<SelectableTextBlock>
```

Returns a strong reference to this object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L46)

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

### selection_start_property

```rust
fn selection_start_property() -> &'static StyledProperty<i32>
```

Defines the `SelectionStart` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L469)

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

### selection_end_property

```rust
fn selection_end_property() -> &'static StyledProperty<i32>
```

Defines the `SelectionEnd` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L469)

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

### selected_text_property

```rust
fn selected_text_property() -> &'static DirectProperty<SelectableTextBlock, String>
```

Defines the `SelectedText` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L469)

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

### selection_brush_property

```rust
fn selection_brush_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
```

Defines the `SelectionBrush` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L469)

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

### selection_foreground_brush_property

```rust
fn selection_foreground_brush_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
```

Defines the `SelectionForegroundBrush` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L469)

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

### can_copy_property

```rust
fn can_copy_property() -> &'static DirectProperty<SelectableTextBlock, bool>
```

Defines the `CanCopy` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L469)

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

### copying_to_clipboard_event

```rust
fn copying_to_clipboard_event() -> &'static RoutedEvent<RoutedEventArgs>
```

Defines the `CopyingToClipboard` event.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L521)

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

### construct

```rust
fn construct() -> Self
```

Creates the class data; see `ferroui_base::FerroObject::construct`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L538)

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

### new

```rust
fn new() -> Ref<Self>
```

Initializes a new instance of the `SelectableTextBlock` class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L550)

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

### copying_to_clipboard

```rust
fn copying_to_clipboard(self: &Self, handler: impl Fn(&Interactive, &RoutedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
```

Raised when the selection is about to be copied to the clipboard;
marking the event handled cancels the copy.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L556)

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

### selection_brush

```rust
fn selection_brush(self: &Self) -> Option<Rc<dyn IBrush>>
```

The brush that highlights selected text.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L564)

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

### set_selection_brush

```rust
fn set_selection_brush(self: &Self, value: Option<Rc<dyn IBrush>>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L568)

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

### selection_foreground_brush

```rust
fn selection_foreground_brush(self: &Self) -> Option<Rc<dyn IBrush>>
```

The brush that is used for the foreground of selected text.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L573)

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

### set_selection_foreground_brush

```rust
fn set_selection_foreground_brush(self: &Self, value: Option<Rc<dyn IBrush>>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L577)

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

### selection_start

```rust
fn selection_start(self: &Self) -> i32
```

The character index of the beginning of the current selection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L582)

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

### set_selection_start

```rust
fn set_selection_start(self: &Self, value: i32)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L586)

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

### selection_end

```rust
fn selection_end(self: &Self) -> i32
```

The character index of the end of the current selection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L591)

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

### set_selection_end

```rust
fn set_selection_end(self: &Self, value: i32)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L595)

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

### selected_text

```rust
fn selected_text(self: &Self) -> String
```

The content of the current selection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L600)

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

### can_copy

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

Whether the copy command can be executed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L605)

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

### copy

```rust
fn copy(self: &Self)
```

Copies the current selection to the clipboard.

Like the asynchronous method of the reference, everything up to the
clipboard call runs before this returns. A failure platform
clipboards are known for (see
`ClipboardHelper::is_expected_clipboard_exception`) is logged; any
other failure, and a panic of the clipboard, is raised on the
dispatcher.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L621)

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

### select_all

```rust
fn select_all(self: &Self)
```

Selects all text of the text block.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L662)

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

### clear_selection

```rust
fn clear_selection(self: &Self)
```

Clears the current selection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selectable_text_block.rs#L670)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ControlImplExt`](/docs/0.5.0/api/ferroui-controls/trait-controlimplext/)
- [`TextBlockImplExt`](/docs/0.5.0/api/ferroui-controls/trait-textblockimplext/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- [`InputElementImplExt`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimplext/)
- [`InteractiveImplExt`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimplext/)
- [`LayoutableImplExt`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimplext/)
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`StyledElementImplExt`](/docs/0.5.0/api/ferroui-base/trait-styledelementimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- [`VisualImplExt`](/docs/0.5.0/api/ferroui-base/trait-visualimplext/)
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<SelectableTextBlock>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`ObjectType`](/docs/0.5.0/api/ferroui-base/trait-objecttype/)
- [`Subclassable<T>`](/docs/0.5.0/api/ferroui-base/trait-subclassable/)
- [`DefaultConstructible`](/docs/0.5.0/api/ferroui-base/trait-defaultconstructible/)
- [`StyledElementImpl`](/docs/0.5.0/api/ferroui-base/trait-styledelementimpl/)
- [`VisualImpl`](/docs/0.5.0/api/ferroui-base/trait-visualimpl/)
- [`LayoutableImpl`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimpl/)
- [`InteractiveImpl`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimpl/)
- [`ControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-controlimpl/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`InputElementImpl`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimpl/)
- [`TextBlockImpl`](/docs/0.5.0/api/ferroui-controls/trait-textblockimpl/)

## Availability

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