I am trying to make a simple text box with up/down attached to it, so if the user presses 'up' the text box increments by one, and if the user presses 'down' it decrements by one.
I understand I could do this using two extra buttons, one controlling up and one controlling down. Is there a simpler way?
'Add a SpinnerTextField to the RootPane
Sub AddSpinner
Dim spMin As Double = 0
Dim spMax As Double = 10
Dim spInitialValue As Double = 5
Dim spAmountToStepBy As Double = 1
joSpinner.InitializeNewInstance("javafx.scene.control.Spinner", Array(spMin, spMax, spInitialValue, spAmountToStepBy))
MainForm.RootPane.AddNode(joSpinner, 20, 100, 100, 20)
End Sub
B4X:
'Get the value of the SpinnerTextField
Sub GetSpinnerValue As Double
Return joSpinner.RunMethodJO("getValueFactory", Null).RunMethod("getValue", Null)
End Sub
B4X:
'Set the value of the SpinnerTextField
Sub SetSpinnerValue(value As Double)
joSpinner.RunMethodJO("getValueFactory", Null).RunMethod("setValue", Array(value))
End Sub