Skip to main content

Class: CursorInput<M>

An input display with a scrolling cursor.

Each input has zero or more child slots of type CursorInputSlot (though to be practically useful, at least one slot is required). When editing is active, the input's cursor selects either one slot or one character (a slot may have more than one character) at a time. The input supports incrementing or decrementing the value of a selected slot, or directly setting/deleting the value of a selected character.

Each input is bound to a composite value. This value is computed from the values of the input's individual slots, and vice versa, so that changes in either will be reflected in the other.

Type parameters

NameType
Mextends MutableSubscribable<any>

Hierarchy

Constructors

constructor

new CursorInput<M>(props): CursorInput<M>

Creates an instance of a DisplayComponent.

Type parameters

NameType
Mextends MutableSubscribable<any, any>

Parameters

NameTypeDescription
propsCursorInputProps<M>The propertis of the component.

Returns

CursorInput<M>

Inherited from

DisplayComponent<CursorInputProps<M>>.constructor

Defined in

src/sdk/components/FSComponent.ts:73

Properties

context

Optional context: [] = undefined

The context on this component, if any.

Inherited from

DisplayComponent.context

Defined in

src/sdk/components/FSComponent.ts:64


contextType

Optional Readonly contextType: readonly [] = undefined

The type of context for this component, if any.

Inherited from

DisplayComponent.contextType

Defined in

src/sdk/components/FSComponent.ts:67


cursorPosition

Readonly cursorPosition: Subscribable<number>

The index of the character position currently selected by this input's cursor.

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/Components/CursorInput/CursorInput.tsx:158


isEditingActive

Readonly isEditingActive: Subscribable<boolean>

Whether editing is active for this input.

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/Components/CursorInput/CursorInput.tsx:162


isSelectionPerSlot

Readonly isSelectionPerSlot: Subscribable<boolean>

Whether this input's cursor selection mode is per-slot.

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/Components/CursorInput/CursorInput.tsx:166


props

props: CursorInputProps<M> & ComponentProps

The properties of the component.

Inherited from

DisplayComponent.props

Defined in

src/sdk/components/FSComponent.ts:61

Methods

activateEditing

activateEditing(isSelectionPerSlot, charToSet?): boolean

Activates editing for this input.

Parameters

NameTypeDescription
isSelectionPerSlotbooleanWhether cursor selection should be initialized to per-slot mode. If false, cursor selection will be initialized to per-character mode instead.
charToSet?null | stringThe value to set at the cursor's selected character position as the initial edit. If defined and the character position cannot accept the value, editing will not be activated. Ignored if isSelectionPerSlot is true.

Returns

boolean

Whether editing is active.

Throws

Error if this input is not initialized.

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/Components/CursorInput/CursorInput.tsx:359


backspace

backspace(selectionPerSlot?): void

Removes the character at the cursor's current position. If backfill is allowed, this will also shift all non-empty characters to the left of the cursor's current position one position to the right. If backfill is not allowed, this will shift the cursor one position to the left after the character is removed.

Parameters

NameTypeDescription
selectionPerSlot?booleanThe selection per slot state to apply before carrying out the backspace operation. If not defined, the selection per slot state will remain unchanged from its current value.

Returns

void

Throws

Error if this input is not initialized.

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/Components/CursorInput/CursorInput.tsx:725


changeSlotValue

changeSlotValue(direction): boolean

Increments or decrements the value of the slot currently selected by the cursor. If editing is not active, it will be activated instead of changing any slot value. If cursor selection is in per-character mode, it will be forced to per-slot mode. If the cursor is past the last slot, this method does nothing.

Parameters

NameTypeDescription
direction1 | -1The direction in which to change the slot value (1 = increment, -1 = decrement).

Returns

boolean

Whether the value of the slot was changed.

Throws

Error if this input is not initialized.

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/Components/CursorInput/CursorInput.tsx:594


deactivateEditing

deactivateEditing(): void

Deactivates editing for this input.

Returns

void

Throws

Error if this input is not initialized.

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/Components/CursorInput/CursorInput.tsx:411


destroy

destroy(): void

Returns

void

Inherit Doc

Overrides

DisplayComponent.destroy

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/Components/CursorInput/CursorInput.tsx:997


getContext

getContext(context): never

Gets a context data subscription from the context collection.

Parameters

NameTypeDescription
contextneverThe context to get the subscription for.

Returns

never

The requested context.

Throws

An error if no data for the specified context type could be found.

Inherited from

DisplayComponent.getContext

Defined in

src/sdk/components/FSComponent.ts:106


isInitialized

isInitialized(): boolean

Checks whether this input is initialized.

Returns

boolean

Whether this input is initialized.

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/Components/CursorInput/CursorInput.tsx:276


moveCursor

moveCursor(direction, forceSelectionPerSlot): void

Moves the cursor.

Parameters

NameTypeDescription
direction1 | -1The direction in which to move (1 = to the right, -1 = to the left).
forceSelectionPerSlotbooleanWhether to force cursor selection to per slot mode.

Returns

void

Throws

Error if this input is not initialized.

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/Components/CursorInput/CursorInput.tsx:429


onAfterRender

onAfterRender(): void

Returns

void

Inherit Doc

Overrides

DisplayComponent.onAfterRender

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/Components/CursorInput/CursorInput.tsx:179


onBeforeRender

onBeforeRender(): void

A callback that is called before the component is rendered.

Returns

void

Inherited from

DisplayComponent.onBeforeRender

Defined in

src/sdk/components/FSComponent.ts:80


placeCursor

placeCursor(index, forceSelectionPerSlot): void

Places the cursor at a specific character position.

Parameters

NameTypeDescription
indexnumberThe index of the character position at which to place the cursor.
forceSelectionPerSlotbooleanWhether to force cursor selection to per slot mode.

Returns

void

Throws

Error if this input is not initialized.

Throws

RangeError if index does not point to a valid character position.

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/Components/CursorInput/CursorInput.tsx:562


populateCharsFromValue

populateCharsFromValue(): void

Populates all of this input's character positions with non-empty values, if possible, using this input's value digitizer function and the current composite value as a template.

Returns

void

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/Components/CursorInput/CursorInput.tsx:856


refresh

refresh(): void

Refreshes this input, updating the size and position of the cursor.

Returns

void

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/Components/CursorInput/CursorInput.tsx:865


render

render(): VNode

Returns

VNode

Inherit Doc

Overrides

DisplayComponent.render

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/Components/CursorInput/CursorInput.tsx:970


setSlotCharacterValue

setSlotCharacterValue(value): boolean

Sets the value of the slot character currently selected by the cursor. If editing is not active, it will be activated before setting the value (unless the selected character cannot accept the value, in which case the operation will be aborted). If cursor selection is in per-slot mode, it will be forced to per-character mode, and the first character of the slot will be selected before setting the value. If the cursor is past the last slot, this method does nothing.

Parameters

NameTypeDescription
valuestringThe value to set.

Returns

boolean

Whether the operation was accepted.

Throws

Error if this input is not initialized.

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/Components/CursorInput/CursorInput.tsx:632


setValue

setValue(value): SubscribableType<M>

Sets the composite value of this input. As part of the operation, all of this input's child slots will have their values set according to this input's value digitizer, and all slot characters will be set to non-null representations of their slot's value, if possible. The composite value of this input after the operation is complete may differ from the requested value depending on whether the requested value can be accurately represented by this input.

Parameters

NameTypeDescription
valueSubscribableType<M>The new composite value.

Returns

SubscribableType<M>

The composite value of this input after the operation is complete.

Throws

Error if this input is not initialized.

Defined in

src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/Components/CursorInput/CursorInput.tsx:290