Vixen
02b45cc4
csharp
public sealed class NumericInput

A field that holds a number, with arrows, spinners and a drag to scrub it.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The number is the value and the text is a rendering of it. Value is still a string — it is a field, and half-typed input like - or 1. has to be allowed to exist for as long as somebody is typing it — but Number is what the application reads, and it is only ever assigned from text that parses.

⚠ Dragging scrubs only while the field is not focused, and that is the whole trick. A field the user is editing has to let them select text with the pointer; a field they are not editing has nothing to select, so the drag is free for something better. It is what every 3D application's inspector does, and it is why a click that does not move still focuses the field: the two gestures start identically and are told apart by whether anything happened next.

Fields and properties (11)

  • protected override string TagName

    The element name this type answers to when a caller does not choose one.

  • public double Number
  • public double Minimum
  • public double Maximum
  • public double Step
  • public int Decimals
  • public static readonly UiPropertyKey NumberProperty

    Identity for Number.

  • public static readonly UiPropertyKey MinimumProperty

    Identity for Minimum.

  • public static readonly UiPropertyKey MaximumProperty

    Identity for Maximum.

  • public static readonly UiPropertyKey StepProperty

    Identity for Step.

  • public static readonly UiPropertyKey DecimalsProperty

    Identity for Decimals.

Events (1)

  • public Action<NumericInput, double>? NumberChanged

    Raised when the number changes.

Methods (10)

  • protected override void OnCreated()

    Builds whatever this element is made of, once, as it joins a document.

  • public void Nudge(double steps)

    Adds a number of steps to the value.

  • protected override string? Coerce(string? value)
  • protected override void OnSubmit()
  • protected override void SelectAt(int index, int count)
  • public void ClearNumber()

    Unsets Number, so it takes its default or its ancestor's value again.

  • public void ClearMinimum()

    Unsets Minimum, so it takes its default or its ancestor's value again.

  • public void ClearMaximum()

    Unsets Maximum, so it takes its default or its ancestor's value again.

  • public void ClearStep()

    Unsets Step, so it takes its default or its ancestor's value again.

  • public void ClearDecimals()

    Unsets Decimals, so it takes its default or its ancestor's value again.

Used by (28)

  • ShellHelloUi
  • NestedMemberTestsVixen.Ui.Controls.Advanced.Tests
  • NodeCanvasTestsVixen.Ui.Controls.Advanced.Tests
  • NodePortEditorVixen.Ui.Controls.Advanced
  • PropertyGridVixen.Ui.Controls.Advanced
  • PropertyGridTestsVixen.Ui.Controls.Advanced.Tests
  • TextFieldTestsVixen.Ui.Controls.Tests
  • AnimationClipViewVixen.Editor.AssetEditors
  • AnimationGraphViewVixen.Editor.AssetEditors
  • AudioMixerViewVixen.Editor.AssetEditors
  • ChromeFixtureVixen.Editor.Ui.Tests
  • ComponentDrawerVixen.Editor.Inspector
  • CompositorViewVixen.Editor.AssetEditors
  • DrawerTestsVixen.Editor.Inspector.Tests
  • EditorAffordanceTestsVixen.Editor.App.Tests
  • FontViewVixen.Editor.AssetEditors
  • InspectorFixtureVixen.Editor.Inspector.Tests
  • MarkupBindingVixen.Editor.Inspector
  • MarkupBindingTestsVixen.Editor.Inspector.Tests
  • MoveSetViewVixen.Editor.AssetEditors
  • NodeInspectorVixen.Editor.NodeGraph
  • NumberDrawerVixen.Editor.Inspector
  • PortValueTestsVixen.Editor.NodeGraph.Tests
  • ProxyShapeViewVixen.Editor.AssetEditors
  • SequenceViewVixen.Editor.AssetEditors
  • ShapeVocabularyViewVixen.Editor.AssetEditors
  • SpriteSheetViewVixen.Editor.AssetEditors
  • SpriteViewTestsVixen.Editor.AssetEditors.Tests