Skip to content

No parameter attribute for number formats #45

Closed
@etadobson

Description

@etadobson

This issue was recently brought up on the forum... currently, if for example, you want to display the a default value of 0.0178 in the dialog for a user…

#@Double(label="Distance", value=0.01780, persist=false) distance

When the code runs… you get a pre-set value of 0.018 popping up and there is no current method to set the number of decimal places for that input.

As stated by @imagejan on the forum:

"The spinner created in SwingNumberWidget is using the default DecimalFormat which apparently has a maximum of three decimal places.

You can somehow work around the issue by using a slider or scroll bar (within a defined range). But while the actual values can contain more decimal places (as shown by the println statement, there’s still no visual feedback inside the spinner text field:

#@ Double (label="Distance", min=0, max=0.05, value=0.01780, persist=false, stepSize=0.0001, style=slider) distance
println distance

There’s no parameter attribute for number formats, but we could maybe use the style attribute for this; in any case we should try to guess a suitable spinner number format from the combination of min, max and stepSize, or from the default value…"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions