Skip to main content

Class: NumberInput

Defined in: workingtitle-instruments-g3000/html_ui/GTC/Components/NumberInput/NumberInput.tsx:81

An input with a scrolling cursor which allows users to select a numeric value. The composite numeric value bound to the input is derived from the sum of the values of all child DigitInputSlots, multiplied by the product of the values of all child SignInputSlots.

Extends

Constructors

Constructor

new NumberInput(props): NumberInput

Defined in: sdk/components/FSComponent.ts:73

Creates an instance of a DisplayComponent.

Parameters

ParameterTypeDescription
propsNumberInputPropsThe propertis of the component.

Returns

NumberInput

Inherited from

DisplayComponent<NumberInputProps>.constructor

Properties

context?

optional context: [] = undefined

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

The context on this component, if any.

Inherited from

DisplayComponent.context


contextType?

readonly optional contextType: readonly [] = undefined

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

The type of context for this component, if any.

Inherited from

DisplayComponent.contextType


props

props: NumberInputProps & ComponentProps

Defined in: sdk/components/FSComponent.ts:61

The properties of the component.

Inherited from

DisplayComponent.props

Accessors

cursorPosition

Get Signature

get cursorPosition(): Subscribable<number>

Defined in: workingtitle-instruments-g3000/html_ui/GTC/Components/NumberInput/NumberInput.tsx:105

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: workingtitle-instruments-g3000/html_ui/GTC/Components/NumberInput/NumberInput.tsx:111

Whether editing is active for this input.

Returns

Subscribable<boolean>


isSelectionPerSlot

Get Signature

get isSelectionPerSlot(): Subscribable<boolean>

Defined in: workingtitle-instruments-g3000/html_ui/GTC/Components/NumberInput/NumberInput.tsx:117

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

Returns

Subscribable<boolean>

Methods

activateEditing()

activateEditing(isSelectionPerSlot): void

Defined in: workingtitle-instruments-g3000/html_ui/GTC/Components/NumberInput/NumberInput.tsx:186

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(selectionPerSlot?): void

Defined in: workingtitle-instruments-g3000/html_ui/GTC/Components/NumberInput/NumberInput.tsx:274

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

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


changeSlotValue()

changeSlotValue(direction): void

Defined in: workingtitle-instruments-g3000/html_ui/GTC/Components/NumberInput/NumberInput.tsx:242

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

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

Returns

void

Throws

Error if this input is not initialized.


deactivateEditing()

deactivateEditing(): void

Defined in: workingtitle-instruments-g3000/html_ui/GTC/Components/NumberInput/NumberInput.tsx:198

Deactivates editing for this input.

Returns

void

Throws

Error if this input is not initialized.


destroy()

destroy(): void

Defined in: workingtitle-instruments-g3000/html_ui/GTC/Components/NumberInput/NumberInput.tsx:338

Returns

void

Inherit Doc

Overrides

DisplayComponent.destroy


getContext()

protected getContext(context): never

Defined in: sdk/components/FSComponent.ts:106

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: workingtitle-instruments-g3000/html_ui/GTC/Components/NumberInput/NumberInput.tsx:158

Checks whether this input is initialized.

Returns

boolean

Whether this input is initialized.


moveCursor()

moveCursor(direction, forceSelectionPerSlot): void

Defined in: workingtitle-instruments-g3000/html_ui/GTC/Components/NumberInput/NumberInput.tsx:212

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: workingtitle-instruments-g3000/html_ui/GTC/Components/NumberInput/NumberInput.tsx:126

Parameters

ParameterType
thisNodeVNode

Returns

void

Inherit Doc

Overrides

DisplayComponent.onAfterRender


onBeforeRender()

onBeforeRender(): void

Defined in: sdk/components/FSComponent.ts:80

A callback that is called before the component is rendered.

Returns

void

Inherited from

DisplayComponent.onBeforeRender


placeCursor()

placeCursor(index, forceSelectionPerSlot): void

Defined in: workingtitle-instruments-g3000/html_ui/GTC/Components/NumberInput/NumberInput.tsx:227

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: workingtitle-instruments-g3000/html_ui/GTC/Components/NumberInput/NumberInput.tsx:286

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: workingtitle-instruments-g3000/html_ui/GTC/Components/NumberInput/NumberInput.tsx:293

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

Returns

void


render()

render(): VNode

Defined in: workingtitle-instruments-g3000/html_ui/GTC/Components/NumberInput/NumberInput.tsx:318

Returns

VNode

Inherit Doc

Overrides

DisplayComponent.render


setSlotCharacterValue()

setSlotCharacterValue(value): void

Defined in: workingtitle-instruments-g3000/html_ui/GTC/Components/NumberInput/NumberInput.tsx:258

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

ParameterTypeDescription
valuestringThe value to set.

Returns

void

Throws

Error if this input is not initialized.


setValue()

setValue(value): number

Defined in: workingtitle-instruments-g3000/html_ui/GTC/Components/NumberInput/NumberInput.tsx:172

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
valuenumberThe new composite value.

Returns

number

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

Throws

Error if this input is not initialized.