Skip to main content

Class: CharInput

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/CharInput/CharInput.tsx:37

An input with a scrolling cursor that allows users to select an arbitrary string. The composite value bound to the input is derived from the in-order concatenation of the values of all child CharInputSlot components.

Extends​

Constructors​

Constructor​

new CharInput(props): CharInput

Defined in: src/sdk/components/FSComponent.ts:76

Creates an instance of a DisplayComponent.

Parameters​

ParameterTypeDescription
propsCharInputPropsThe propertis of the component.

Returns​

CharInput

Inherited from​

DisplayComponent.constructor

Properties​

context?​

optional context: [] = undefined

Defined in: src/sdk/components/FSComponent.ts:67

The context on this component, if any.

Inherited from​

DisplayComponent.context


contextType?​

readonly optional contextType: readonly [] = undefined

Defined in: src/sdk/components/FSComponent.ts:70

The type of context for this component, if any.

Inherited from​

DisplayComponent.contextType


props​

props: CharInputProps & ComponentProps

Defined in: src/sdk/components/FSComponent.ts:64

The properties of the component.

Inherited from​

DisplayComponent.props

Accessors​

cursorPosition​

Get Signature​

get cursorPosition(): Subscribable<number>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/CharInput/CharInput.tsx:48

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

Returns​

Subscribable<number>


isEditingActive​

Get Signature​

get isEditingActive(): Subscribable<boolean>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/CharInput/CharInput.tsx:54

Whether editing is active for this input.

Returns​

Subscribable<boolean>


isSelectionPerSlot​

Get Signature​

get isSelectionPerSlot(): Subscribable<boolean>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/CharInput/CharInput.tsx:60

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

Returns​

Subscribable<boolean>

Methods​

activateEditing()​

activateEditing(isSelectionPerSlot): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/CharInput/CharInput.tsx:131

Activates editing for this input.

Parameters​

ParameterTypeDescription
isSelectionPerSlotbooleanWhether cursor selection should be initialized to per-slot mode. If false, cursor selection will be initialized to per-character mode instead.

Returns​

void

Throws​

Error if this input is not initialized.


backspace()​

backspace(): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/CharInput/CharInput.tsx:247

Removes the character at the cursor's current position and shifts the cursor one position to the left after the character is removed.

Returns​

void

Throws​

Error if this input is not initialized.


changeSlotValue()​

changeSlotValue(direction, eraseCharsToRightOnEdit): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/CharInput/CharInput.tsx:200

Increments or decrements the value of the slot currently selected by the cursor. If editing is not active, then 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, then this method does nothing.

Parameters​

ParameterTypeDefault valueDescription
direction-1 | 1undefinedThe direction in which to change the slot value (1 = increment, -1 = decrement).
eraseCharsToRightOnEditbooleanfalseWhether to erase (set to null) all characters to the right of the edited character. Defaults to false.

Returns​

void

Throws​

Error if this input is not initialized.


deactivateEditing()​

deactivateEditing(): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/CharInput/CharInput.tsx:143

Deactivates editing for this input.

Returns​

void

Throws​

Error if this input is not initialized.


destroy()​

destroy(): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/CharInput/CharInput.tsx:312

Destroys this component.

Returns​

void

Overrides​

DisplayComponent.destroy


getContext()​

protected getContext(context): never

Defined in: src/sdk/components/FSComponent.ts:109

Gets a context data subscription from the context collection.

Parameters​

ParameterTypeDescription
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


isInitialized()​

isInitialized(): boolean

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/CharInput/CharInput.tsx:103

Checks whether this input is initialized.

Returns​

boolean

Whether this input is initialized.


moveCursor()​

moveCursor(direction, forceSelectionPerSlot): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/CharInput/CharInput.tsx:157

Moves the cursor.

Parameters​

ParameterTypeDescription
direction-1 | 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.


onAfterRender()​

onAfterRender(thisNode): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/CharInput/CharInput.tsx:69

A callback that is called after the component is rendered.

Parameters​

ParameterTypeDescription
thisNodeVNodeThe component's VNode.

Returns​

void

Overrides​

DisplayComponent.onAfterRender


onBeforeRender()​

onBeforeRender(): void

Defined in: src/sdk/components/FSComponent.ts:83

A callback that is called before the component is rendered.

Returns​

void

Inherited from​

DisplayComponent.onBeforeRender


placeCursor()​

placeCursor(index, forceSelectionPerSlot): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/CharInput/CharInput.tsx:183

Places the cursor at a specific character position.

Parameters​

ParameterTypeDescription
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.


populateCharsFromValue()​

populateCharsFromValue(): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/CharInput/CharInput.tsx:259

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


refresh()​

refresh(): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/CharInput/CharInput.tsx:266

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

Returns​

void


render()​

render(): VNode

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/CharInput/CharInput.tsx:294

Renders the component.

Returns​

VNode

A JSX element to be rendered.

Overrides​

DisplayComponent.render


setSlotCharacterValue()​

setSlotCharacterValue(value, eraseCharsToRightOnEdit): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/CharInput/CharInput.tsx:224

Sets the value of the slot character currently selected by the cursor. If editing is not active, then it will be activated before setting the value. If the cursor is past the last slot, then this method does nothing.

Parameters​

ParameterTypeDefault valueDescription
valuestringundefinedThe value to set.
eraseCharsToRightOnEditbooleanfalseWhether to erase (set to null) all characters to the right of the edited character. Defaults to false.

Returns​

void

Throws​

Error if this input is not initialized.


setValue()​

setValue(value): string

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/Components/CharInput/CharInput.tsx:117

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​

ParameterTypeDescription
valuestringThe new composite value.

Returns​

string

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

Throws​

Error if this input is not initialized.