Android Question [SOLVED] B4XPreferencesDialog. Set steps of numeric range to 0.5

josejad

Expert
Licensed User
Longtime User
Do you now a way you can choose numbers with 0.5 steps?
This don't work
{
"options": [
"0, 8.5, 0.5"
],
"title": "HNor",
"type": "Numeric Range",
"key": "HNor",
"required": false
},

thanks¡¡
 

PaulMeuris

Well-Known Member
Licensed User
If the Numeric Range view of a B4XPreferencesDialog is a B4XPlusMinus view then you can set the range with intervals of 0.5 (double):
1761879194128.png

B4X:
B4XPlusMinus1.SetNumericRange(0.0,10.0,0.5)
 
Upvote 1

josejad

Expert
Licensed User
Longtime User
B4XPlusMinus1.SetNumericRange(0.0,10.0,0.5)
Thanks Paul, it works too.

I haven't found the way to reach the B4XPlusMinus inside the prefDialog, but there's an "EXTRA" property that is a map with the values ((MyMap) {start=0.0, end=8.5, interval=0.5}).

So I can set the maximum number this way. It will be more flexible to set the max number in some situations I need

B4X:
    For i = 0 To PrefDialog.PrefItems.Size - 1
        Dim pi As B4XPrefItem = PrefDialog.PrefItems.Get(i)
        Log (pi.ItemType)
        PrefDialog.CustomListView1.AnimationDuration = 0
        If pi.ItemType = PrefDialog.TYPE_NUMERICRANGE Then
            Log(pi.Key)
            If pi.Key = "HNor" Then
                Log(pi.Extra)
                pi.Extra.Put("end", 8.5) 'I can set "start, end and interval" with variables in runtime!!
            End If
        End If
    Next
 
Upvote 0
Top