I have been looking for a numberspinner that allows Doubles as well as Integers to port for B4j but haven't been able to find one that did exactly what I wanted, so I decided I would write one, and here it is.
It uses NumberFormat2 to display the output and therefore has it's options. Although if you don't specify Minimum Integers or Grouping then 0 and False are assumed.
The spinner responds to Clicks on the Spinners arrows, and the Keyboard Up and Down Arrows.
The available methods are:
NumberSpinner
Author: Steve Laming
Version: 1
Provided callbacks are:
{EventName}_ValueChanged(Val As Double,UserChanged As Boolean)
- Called when a value is changed
and
{EventName}_EntryReleased(Val As Double)
- Called when the Mouse Button or Up or Down arrow Keys are released.
The ENumClass code is also in the project.
Depends on:
javaobject, jenumclass
i hope you find it useful.
It uses NumberFormat2 to display the output and therefore has it's options. Although if you don't specify Minimum Integers or Grouping then 0 and False are assumed.
The spinner responds to Clicks on the Spinners arrows, and the Keyboard Up and Down Arrows.
The available methods are:
NumberSpinner
Author: Steve Laming
Version: 1
- Methods:
AsNode As Node
Get the AnchorPane that holds the NumberSpinner
Grouping As Boolean
Set whether grouping should be displayed
Increment As Double
Get / set the Increment
Initialize(Module As Object, EventName As String, MinimumIntegers As Int, MaximumFractions As Int, Increment As Double) As String
Initializes the object and set's the callback eventname and minimum required options.
IsInitialized As Boolean
Get the Initialized state of this Object
Layout(Left As Double, Top As Double, Width As Double, Height As Double) As String - [Write Only]
Set the Layout of the AnchorPane
Left As Double
Get/Set the AnchorPane Left value
MaxFractions As Int
Get / Set the maximum number of decimal places to display
MaxValue As Double
Get / Set the Maximum values
MinFractions As Int
Get / Set the minimum number of decimal places to display
MinIntegers As Int
Get / Set the minimum number of Integers to display
MinValue As Double
Get / Set the Minimum values
PrefHeight As Double
Get/Set the AnchorPane PrefHeight value
PrefWidth As Double
Get/Set the AnchorPane PrefWidth value
Top As Double
Get/Set the AnchorPane Top value
Value As Double
Get / Set the current Value. Should be between MinVal and MaxVal inclusive (if set)
Provided callbacks are:
{EventName}_ValueChanged(Val As Double,UserChanged As Boolean)
- Called when a value is changed
and
{EventName}_EntryReleased(Val As Double)
- Called when the Mouse Button or Up or Down arrow Keys are released.
The ENumClass code is also in the project.
Depends on:
javaobject, jenumclass
i hope you find it useful.
Attachments
Last edited: