CNumberEdit
An arithmetic line editor. The underlying text is always the expression, so changing focus does not replace it or clear its undo history. When unfocused, painting shows the committed value or a red ERR marker.
import { CNumberEdit } from "canvas-toolkit-lib";Declared members
readonly expressionChanged: CSignal<[string]>;readonly valueChanged: CSignal<[number]>;constructor(parent?: CWidget | null);expression(): string;value(): number;decimals(): number;errorString(): string;setDecimals(decimals: number): void;Maximum displayed decimal places; trailing zeros are omitted.
setExpression(expression: string): boolean;Sets and evaluates an expression. Forbidden characters reject the whole assignment. Invalid arithmetic keeps the expression for correction and leaves value() unchanged. Returns whether evaluation succeeded.
setText(text: string): void;setValue(value: number): void;Replaces the expression with a numeric literal.
displayText(): string;Text currently painted; text()/expression() always return the formula.
insert(text: string): void;Rejects an entire insertion/paste if any character is forbidden.
commit(): boolean;Commits a complete expression without rounding the stored value.
protected keyPressEvent(event: CKeyEvent): void;protected focusInEvent(event: CFocusEvent): void;protected focusOutEvent(event: CFocusEvent): void;protected paintEvent(painter: CPainter): void;