B4A Library [B4X] [XUI] AS WheelPicker - Spinner - a modern single/multiple choice picker view - based on xCustomListView [Payware]

Hello,
this is a modern wheel picker, like the IOS-PickerView.
WheelPicker/Spinner

This library is not free, because, it cost a lot of time and gray hair to create such views.
Thanks for your understanding. :)

V3.00-Preview
1673369032159.png

B4I-Preview - looks nicer and smoother in real
dffdf.gif

B4I-Preview - the WheelPicker in the use in an app
fddsfdsf.gif
IMG_2299.jpg

B4A-Preview
21-02-06-03-05-39.gif

NEW Seperators with text or without text
IMG_3504.jpg
IMG_3389.jpg

NEW Next- and Previous-Item - scrolls to the next or previous item animated and male rounded corners
ezgif.com-gif-maker.gif

RPReplay_Final1639236126.gif

Based on ASWheelPicker:
B4j: jXUI,jBitmapCreator,jReflection,xCustomListView,XUI Views
B4a: XUi,BitmapCreator,Reflection,xCustomListView,XUI Views
B4i: iXUI,iBitmapCreator,xCustomListView,XUI Views
On B4I you need the GestureRecognizer or download a version without errors down below. No longer needed V1.06+
Examples:
Add 2 Wheels with a list of maps:
Dim tmp_lst As List : tmp_lst.Initialize 'Create and Initialize the list
    'Fill the list with dummy items
    For i = 0 To 50 -1
    'text - the text to display in the wheel
    'value - any value you want to identify the text E.g. a id
    tmp_lst.Add(CreateMap("text":"Test " & i,"value":i))
Next
ASWheelPicker1.AddWheelAdvanced(tmp_lst)'adds the list to the view and adds a wheel
Get the Selected Items:
'gets the item of the first wheel
'use this function when you have added the wheel with AddWheelAdvanced
Dim tmp_m As Map = ASWheelPicker1.GetSelectedItemAdvanced(0)
Log("Text: " & tmp_m.Get("text"))
Log("Value: " & tmp_m.Get("value"))

'use this function when you have added the wheel with AddWheel
Log("Text: " & ASWheelPicker1.GetSelectedItem(0))
ASWheelPicker
Author: Alexander Stolte
Version: 3.01

  • ASWheelPicker
    • Events:
      • BaseResize (Width As Float)
      • ItemChange (Column As Int, ListIndex As Int)
      • ItemSnapped (wheel_index As Int, list_index As Int)
      • WheelReachEnd (wheel_index As Int)
    • Fields:
      • InactiveDuration As Int
      • mBase As B4XView
      • Tag As Object
    • Functions:
      • AddItems (Items As List) As String
        Examples
        Normal Text Item
        <code>Dim tmp_lst As List : tmp_lst.Initialize
        For i = 0 To 50 -1
        tmp_lst.Add("Test " & i)
        Next
        ASWheelPicker1.AddItems(tmp_lst)</code>
        Item Object Example:
        <code> Dim Items As List : Items.Initialize
        For i = 0 To 50 -1
        Dim Item As ASWheelPicker_Item
        Item.Initialize
        Item.Text = "Test " & i
        Item.Value = i
        Items.Add(ASWheelPicker1.CreateASWheelPicker_Item("Test " & i,i))
        Next
        ASWheelPicker1.AddItems(Items)</code>
      • Base_Resize (Width As Double, Height As Double) As String
      • Class_Globals As String
      • CreateASWheelPicker_Item (Text As String, Value As Object) As ASWheelPicker_Item
      • CreateASWheelPicker_ItemTextProperties (TextColor As Int, TextFont As B4XFont, TextAlignment_Vertical As String, TextAlignment_Horizontal As String, BackgroundColor As Int) As ASWheelPicker_ItemTextProperties
      • CreateASWheelPicker_SeperatorProperties (Width As Float, BackgroundColor As Int, TextColor As Int, TextFont As B4XFont, TextAlignment_Horizontal As String, index As Int) As ASWheelPicker_SeperatorProperties
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map) As String
        Base type must be Object
      • getBase As B4XView
        gets the base view (mBase)
      • getBottomFadePanel As B4XView
      • getEvents As Boolean
      • GetIndex (wheel_index As Int) As Int
        gets the selected index
      • getItemTextProperties As ASWheelPicker_ItemTextProperties
        gets or sets the global Item Text Properties
      • getNumberOfColumns As Int
        the number of wheels you have
      • getNumberOfSeperators As Int
        the number of seperators
      • GetSelectedItem (Column As Int) As ASWheelPicker_Item
        Returns a string with the item text of the selected index of a wheel
        <code>Log("Text: " & ASWheelPicker1.GetSelectedItem(0))</code>
      • getSelectorPanel As B4XView
      • getSeperatorProperties As ASWheelPicker_SeperatorProperties
        gets or sets the global Seperator Properties
      • getTopFadePanel As B4XView
      • Initialize (Callback As Object, EventName As String) As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • NextItem (wheel_index As Int, animated As Boolean)
        scrolls to the next item, jump to the first item if the next item is out of index
      • PreviousItem (Column As Int, Animated As Boolean)
        scrolls to the previous item, jump to the last item if the previous item is out of index
      • Refresh As String
      • RemoveColumn (Column As Int) As String
        removes a wheel
        <code>ASWheelPicker1.RemoveWheelAt(0)</code>
      • RemoveSeperatorAt (Column As Int) As String
        removes a seperator
        <code>ASWheelPicker1.RemoveSeperatorAt(0)</code>
      • SelectRow (Column As Int, Row As Int, Animated As Boolean)
        scrolls to an item on a wheel
      • setBackgroundColor (clr As Int) As String
        sets the background color
      • setCornerRadius (Radius As Int) As String
        sets the corner radius of the view
      • setEvents (Enabled As Boolean) As String
        Enables or disables the events
        Default: True
      • setFadeColor (clr As Int) As String
      • setFadeEnabled (enable As Boolean) As String
        set it to false to disable the fade effect on top and bottom
      • setHapticFeedback (enabled As Boolean) As String
      • setHapticFeedbackOnSnapIn (Enabled As Boolean) As String
      • SetItems (Column As Int, Items As List) As String
        Examples
        Normal Text Item
        <code>Dim tmp_lst As List : tmp_lst.Initialize
        For i = 0 To 50 -1
        tmp_lst.Add("Test " & i)
        Next
        ASWheelPicker1.SetItems(0,tmp_lst)</code>
        Item Object Example:
        <code> Dim Items As List : Items.Initialize
        For i = 0 To 50 -1
        Dim Item As ASWheelPicker_Item
        Item.Initialize
        Item.Text = "Test " & i
        Item.Value = i
        Items.Add(ASWheelPicker1.CreateASWheelPicker_Item("Test " & i,i))
        Next
        ASWheelPicker1.SetItems(0,Items)</code>
      • setRowHeightSelected (height As Float) As String
        sets the Selected RowHeight default is 30dip - and changes the wheel items height + selector
      • setRowHeightUnSelected (height As Float) As String
        sets the Unselected RowHeight default is 30dip - and changes the wheel items height
      • setSelectionBarColor (clr As Int) As String
      • SetSeperator (Column As Int, Width As Float, Text As String) As String
        wheel_index - after wich wheel do you want to show the seperator - set it to -1 to place it before the first wheel
        width - the width of the seperator
        text - if you want text, then set the text here
      • SetWheelWidth (Column As Int, ColumnWidth As Float) As String
        Sets the width of an wheel
        Only working if you set the Width Mode to Manual
      • Size (wheel_index As Int) As Int
        gets size of a list
    • Properties:
      • BackgroundColor
        sets the background color
      • Base As B4XView [read only]
        gets the base view (mBase)
      • BottomFadePanel As B4XView [read only]
      • CornerRadius
        sets the corner radius of the view
      • Events As Boolean
        Enables or disables the events
        Default: True
      • FadeColor
      • FadeEnabled
        set it to false to disable the fade effect on top and bottom
      • HapticFeedback
      • HapticFeedbackOnSnapIn
      • ItemTextProperties As ASWheelPicker_ItemTextProperties [read only]
        gets or sets the global Item Text Properties
      • NumberOfColumns As Int [read only]
        the number of wheels you have
      • NumberOfSeperators As Int [read only]
        the number of seperators
      • RowHeightSelected
        sets the Selected RowHeight default is 30dip - and changes the wheel items height + selector
      • RowHeightUnSelected
        sets the Unselected RowHeight default is 30dip - and changes the wheel items height
      • SelectionBarColor
      • SelectorPanel As B4XView [read only]
      • SeperatorProperties As ASWheelPicker_SeperatorProperties [read only]
        gets or sets the global Seperator Properties
      • TopFadePanel As B4XView [read only]
  • ASWheelPicker_Item
    • Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • ItemTextProperties As ASWheelPicker_ItemTextProperties
      • Text As String
      • Value As Object
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASWheelPicker_ItemTextProperties
    • Fields:
      • BackgroundColor As Int
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Left As Float
      • TextAlignment_Horizontal As String
      • TextAlignment_Vertical As String
      • TextColor As Int
      • TextFont As B4XFont
      • Width As Float
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASWheelPicker_SeperatorProperties
    • Fields:
      • BackgroundColor As Int
      • index As Int
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • TextAlignment_Horizontal As String
      • TextColor As Int
      • TextFont As B4XFont
      • Width As Float
    • Functions:
      • Initialize
        Initializes the fields to their default value.
Changelog
  • 1.00
    • Release
  • 1.01
    • Adds the Type ASWheelPicker_ItemTextProperties - hold the style propterties for the wheel text
      • Adds get ItemTextProperties - change the properties before you add a new wheel
    • Adds set RowHeight - changes the row height of the items and the selector
    • Adds UpdateStyleOfWheel - update the style of a particular wheel - changes the style to the properties of this: ItemTextProperties
    • Adds UpdateStyleOfAllWheels - update the style of all wheels - changes the style to the properties of this: ItemTextProperties
    • Adds RemoveWheelAt - removes a wheel
  • 1.02
    • Adds FadeEnabled - set it to false to disable the fade effect on top and bottom
    • Adds RowHeightSelected - sets the Selected RowHeight default is 30dip - and changes the wheel items height + selector
    • Adds RowHeightUnSelected - sets the Unselected RowHeight default is 30dip - and changes the wheel items height
    • Removed RowHeight - use RowHeightSelected and RowHeightUnSelected
  • 1.03
    • Add get Base - gets the base view (mBase)
    • Add Scroll2Index - scrolls to an item on a wheel
    • Add get Index - gets the selected index
  • 1.04
    • Add Size - gets size of a list
    • the index of a list now starts at 0
  • 1.05
    • Add AddSeperator - adds an seperator after a wheel. IF you want a placeholder before the first wheel, then set the index to -1
      • seperators can display text
      • seperators can be customized
    • Add RemoveSeperatorAt - removes a seperator
  • 2.00
    • Better Handling if you set an invalid wheel_index as parameter to the functions
    • Add get TopFadePanel
    • Add get BottomFadePanel
    • Fade Panels are now above and under the selector panel
    • Add Next - scrolls to the next item, jump to the last item if the next item is out of index
      • ezgif.com-gif-maker.gif
    • Add Previous - scrolls to the previous item, jump to the last item if the previous item is out of index
    • Add set CornerRadius - sets the corner radius of the view
      • Add Designer Property CornerRadius
    • SnapIn Improved - Immediately snaps into place without moving again
    • BugFixes
    • new depency: XUIViews, is needed for the HapticFeedback
  • 2.01
    • Add get NumberOfSeperators - the number of seperators
    • BugFix View Resizing
  • 2.03
    • Add Event BaseResize - Triggers as soon as the width in the view has changed
    • Add Event ItemChange - Triggers when an item reaches the center while scrolling, so you can display the results e.g. in a label instant
    • B4I Item snap is now smooth
  • 2.04 (read more)
    • Complete rework of the wheel sizing
    • Add Designer Property WidthMode - Default: Automatic
      • Automatic - You don't have to worry about anything, the view calculates the right size for all wheels
      • Manual - Set the wheel sizes you need via "SetWheelWidth"
    • Add WheelWidth to ItemTextProperties - This allows you to set the width of a wheel manually, only working if WidthMode = Manual - Default: 0
    • Add SetWheelWidth - Sets the width of an wheel, only working if WidthMode = Manual
    • Add get and set Events - Enables or disables the events
    • Haptic feedback disabled if you call Scroll2Index
    • BugFixes
  • 2.06
    • BugFixes
    • GestureRecognizer is now inside the B4XLib
  • 3.00
    • Complete rewrite of the view
    • Designer properties now have all default values
      • If you add the view by code, you have less to consider
    • The lists now use LazyLoading
    • Breaking Changes on properties and functions
  • 3.01
    • Add GetItem
  • 3.02
    • Add GetSeperator
  • 3.03
    • BugFixes
    • Add AddItemAt
    • Add RemoveItemAt
    • Add GetListView - gets the xCustomListView for a column
  • 3.04 (read more)
    • Add Event CustomDrawItemChange
  • 3.05
    • BugFixes
  • 3.06
    • BugFixes
  • 3.07
    • BugFixes
  • 3.08
    • BugFixes B4I
  • 3.09
    • GestureRecongnizer intern renamings
  • 3.10
    • BugFix - in function GetItem
  • 3.11 (read more)
    • Add Designer Property TextColor
    • Add Designer Property SelectionBarStyle
      • Default: Rounded
  • 3.12
    • Add SelectRow2 - Select a row with the Value, no index needed, just the value
    • BugFixes
  • 3.13
    • If the FadeColor is Transparent, then no fade will be displayed now
  • 3.14
    • BugFixes
  • 3.15 (read more)
    • Add EnabledRow - Disable a specific row. When the user goes on it, he is automatically brought back to an item that is active. Events are not triggered when a row is disabled
    • Add Designer Property DisabledTextColor
  • 3.16
    • Add get and set BorderWidth
    • Add get and set BorderColor
  • 3.17
    • B4A Border BugFix
  • 3.18
    • B4A Border BugFix
  • 3.19
    • Add RefreshCustomDraw - Triggers the CustomDrawEvent
      • Dont forget a Sleep(0) before you call this function
  • 3.20
    • BugFixes
  • 3.21
    • Add Event CustomDrawItem
    • Fade Effect BugFixes
  • 3.22
    • Important B4I BugFix
  • 3.23
    • Add Clear - Clears a column
      • SetItems already clears the list if you set a new list
Have Fun :)
 

Attachments

  • b4j preview.JPG
    b4j preview.JPG
    16.3 KB · Views: 4,363
  • Backup 1.05 ASWheelPicker.zip
    6.6 KB · Views: 730
  • GestureRecognizer.bas
    11.2 KB · Views: 703
  • Backup 2.03 ASWheelPicker.zip
    7.7 KB · Views: 554
  • 2.06 Backup.zip
    10.9 KB · Views: 517
  • Example WheelPicker.zip
    179.1 KB · Views: 391
  • ASWheelPicker.zip
    13.3 KB · Views: 325
Last edited:

jboavida

Member
Licensed User
Longtime User
Hello,
I have a compiler problem. I use android Phone V10. And B4A 11.0. I'm using the example provided
Please help. Thanks
1630044710395.png


Joaquim
 

jboavida

Member
Licensed User
Longtime User
Hi, Can you share a more complete example please? I want to to integrate the picker on my app. From the example source code is not easy...
Sorry i'm not very experienced. My application does not use b4xmainpage and compiles well. I just want to to add a number picker.
Thanks
 

Alexander Stolte

Expert
Licensed User
Longtime User
I just want to to add a number picker.
B4X:
Dim tmp_lst As List : tmp_lst.Initialize 'Create and Initialize the list
For i = 0 To 50 -1
    tmp_lst.Add(i)
Next
ASWheelPicker1.AddWheel(tmp_lst)'adds the list to the view and adds a wheel
 

jboavida

Member
Licensed User
Longtime User
Hi,
It is working. But I have now another problem. I want to add 4 different pickers with 4 numbers each. I have created the pickers also in the designer (exact copy) and every one of them work fine except for the font size and separator... font is ok on picker 1 and 3 and separator is ok on picker 2 and 4..
What i'm doing wrong?

Thanks and sorry for all the questions.

1630142076317.jpeg

B4X:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Private ASWheelPicker1 As ASWheelPicker
    Private ASWheelPicker2 As ASWheelPicker   
    Private ASWheelPicker3 As ASWheelPicker
    Private ASWheelPicker4 As ASWheelPicker

End Sub

Public Sub Initialize
    
End Sub

'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("frm_main")
    B4XPages.SetTitle(Me,"Pa_Price")
    
    'ASWheelPicker1.CornerRadius = 20dip'can be set in the designer
    
    
    
    
    ASWheelPicker1.RowHeightSelected = 70dip
    ASWheelPicker1.RowHeightUnSelected = 60dip
    
    ASWheelPicker2.RowHeightSelected = 70dip
    ASWheelPicker2.RowHeightUnSelected = 60dip
    
    ASWheelPicker3.RowHeightSelected = 70dip
    ASWheelPicker3.RowHeightUnSelected = 60dip
    
    ASWheelPicker4.RowHeightSelected = 70dip
    ASWheelPicker4.RowHeightUnSelected = 60dip
    

    ASWheelPicker1.ItemTextProperties.TextFont = xui.CreateDefaultBoldFont(50) 'makes the items bold
    ASWheelPicker2.SeperatorProperties.TextFont = xui.CreateDefaultBoldFont(50) 'makes the seperator text bold
    ASWheelPicker3.ItemTextProperties.TextFont = xui.CreateDefaultBoldFont(50) 'makes the items bold
    ASWheelPicker4.SeperatorProperties.TextFont = xui.CreateDefaultBoldFont(50) 'makes the seperator text bold
    
    ASWheelPicker1.FadeColor = xui.Color_Transparent 'no fade color effect
    'set the same color as the view so that the upper and lower numbers are not visible and there is a slide in effect
    ASWheelPicker1.TopFadePanel.Color = xui.Color_ARGB(255,60, 64, 67)
    ASWheelPicker1.BottomFadePanel.Color = xui.Color_ARGB(255,60, 64, 67)

    ASWheelPicker2.FadeColor = xui.Color_Transparent 'no fade color effect
    'set the same color as the view so that the upper and lower numbers are not visible and there is a slide in effect
    ASWheelPicker2.TopFadePanel.Color = xui.Color_ARGB(255,60, 64, 67)
    ASWheelPicker2.BottomFadePanel.Color = xui.Color_ARGB(255,60, 64, 67)

    ASWheelPicker3.FadeColor = xui.Color_Transparent 'no fade color effect
    'set the same color as the view so that the upper and lower numbers are not visible and there is a slide in effect
    ASWheelPicker3.TopFadePanel.Color = xui.Color_ARGB(255,60, 64, 67)
    ASWheelPicker3.BottomFadePanel.Color = xui.Color_ARGB(255,60, 64, 67)

    ASWheelPicker4.FadeColor = xui.Color_Transparent 'no fade color effect
    'set the same color as the view so that the upper and lower numbers are not visible and there is a slide in effect
    ASWheelPicker4.TopFadePanel.Color = xui.Color_ARGB(255,60, 64, 67)
    ASWheelPicker4.BottomFadePanel.Color = xui.Color_ARGB(255,60, 64, 67)



    
    'Add the numbers to wheel 1
    Dim tmp_lst As List : tmp_lst.Initialize
    For i = 0 To 9
        tmp_lst.Add(i)
    Next
    ASWheelPicker1.AddWheel(tmp_lst)
    ASWheelPicker1.AddWheel(tmp_lst)
    ASWheelPicker1.AddWheel(tmp_lst)
    ASWheelPicker1.AddWheel(tmp_lst)
    ASWheelPicker1.SeperatorProperties.BackgroundColor = xui.Color_ARGB(255,60, 64, 67)'sets the seperator backgroundcolor matched to the view background color
    ASWheelPicker1.AddSeperator(0,15dip,".")'adds the seperator
    
    ASWheelPicker2.AddWheel(tmp_lst)
    ASWheelPicker2.AddWheel(tmp_lst)
    ASWheelPicker2.AddWheel(tmp_lst)
    ASWheelPicker2.AddWheel(tmp_lst)
    ASWheelPicker2.SeperatorProperties.BackgroundColor = xui.Color_ARGB(255,60, 64, 67)'sets the seperator backgroundcolor matched to the view background color
    ASWheelPicker2.AddSeperator(0,15dip,".")'adds the seperator

    ASWheelPicker3.AddWheel(tmp_lst)
    ASWheelPicker3.AddWheel(tmp_lst)
    ASWheelPicker3.AddWheel(tmp_lst)
    ASWheelPicker3.AddWheel(tmp_lst)
    ASWheelPicker3.SeperatorProperties.BackgroundColor = xui.Color_ARGB(255,60, 64, 67)'sets the seperator backgroundcolor matched to the view background color
    ASWheelPicker3.AddSeperator(0,15dip,".")'adds the seperator

    ASWheelPicker4.AddWheel(tmp_lst)
    ASWheelPicker4.AddWheel(tmp_lst)
    ASWheelPicker4.AddWheel(tmp_lst)
    ASWheelPicker4.AddWheel(tmp_lst)
    ASWheelPicker4.SeperatorProperties.BackgroundColor = xui.Color_ARGB(255,60, 64, 67)'sets the seperator backgroundcolor matched to the view background color
    ASWheelPicker4.AddSeperator(0,15dip,".")'adds the seperator
    
End Sub


Private Sub B4XSwitch1_ValueChanged (Value As Boolean)
    If Value Then
        ASWheelPicker1.SelectionBarColor = xui.Color_Transparent
        ASWheelPicker2.SelectionBarColor = xui.Color_Transparent
        ASWheelPicker3.SelectionBarColor = xui.Color_Transparent
        ASWheelPicker4.SelectionBarColor = xui.Color_Transparent
    Else
        ASWheelPicker1.SelectionBarColor = xui.Color_White
        ASWheelPicker2.SelectionBarColor = xui.Color_White
        ASWheelPicker3.SelectionBarColor = xui.Color_White
        ASWheelPicker4.SelectionBarColor = xui.Color_White
    End If
End Sub

Private Sub ASWheelPicker1_ItemSnapped(wheel_index As Int,list_index As Int)
    Log("Index: " & list_index)
End Sub

Private Sub ASWheelPicker2_ItemSnapped(wheel_index As Int,list_index As Int)
    Log("Index: " & list_index)
End Sub

Private Sub ASWheelPicker3_ItemSnapped(wheel_index As Int,list_index As Int)
    Log("Index: " & list_index)
End Sub

Private Sub ASWheelPicker4_ItemSnapped(wheel_index As Int,list_index As Int)
    Log("Index: " & list_index)
End Sub
 

Alexander Stolte

Expert
Licensed User
Longtime User
What i'm doing wrong?
B4X:
    ASWheelPicker1.ItemTextProperties.TextFont = xui.CreateDefaultBoldFont(50) 'makes the items bold
    ASWheelPicker2.SeperatorProperties.TextFont = xui.CreateDefaultBoldFont(50) 'makes the seperator text bold
    ASWheelPicker3.ItemTextProperties.TextFont = xui.CreateDefaultBoldFont(50) 'makes the items bold
    ASWheelPicker4.SeperatorProperties.TextFont = xui.CreateDefaultBoldFont(50) 'makes the seperator text bold
Because you are changing only for Picker 1 and 3 the ItemTextProperties for the other 2 you are only changing the SeperatorProperties.
 

jboavida

Member
Licensed User
Longtime User
Hi All,
It's me again....
Code is almost done and working ok. I'm in the final tests in several different devices.
It works ok in Android 10 devices, but in one device with android 8.1 it fails.

1630319538764.png


The program crashes at line 178
1630319755024.png


it only happens with the device using android 8.1

Thanks
 

Attachments

  • 1630319688346.png
    1630319688346.png
    26.8 KB · Views: 252

Lello1964

Well-Known Member
Licensed User
Longtime User
I'm trying to use AsWheelPicker in B4J and i wanna use it with next and previous item with arrows. I put all dependencies but it doesn't work.
Could you help me please, can tell ma a sample with up and down ?
 

Alexander Stolte

Expert
Licensed User
Longtime User
Could you help me please, can tell ma a sample with up and down ?
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 2.03
    • Add Event BaseResize - Triggers as soon as the width in the view has changed
    • Add Event ItemChange - Triggers when an item reaches the center while scrolling, so you can display the results e.g. in a label instant
    • B4I Item snap is now smooth
ItemChange
with this event you can do something like this:
RPReplay_Final1639236126.gif

B4I Item snap is now smooth
In B4A it already feels smooth enough, but in B4I it feels much better now.
BaseResize
will only become relevant in the next update. In the next update you can adjust the width of the wheels themselves, so it is possible to display more text with more width if you need it.
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
There is a backup of version 2.03 in the 1st post in case of problems

  • 2.04 (read more)
    • Complete rework of the wheel sizing
    • Add Designer Property WidthMode - Default: Automatic
      • Automatic - You don't have to worry about anything, the view calculates the right size for all wheels
      • Manual - Set the wheel sizes you need via "SetWheelWidth"
    • Add WheelWidth to ItemTextProperties - This allows you to set the width of a wheel manually, only working if WidthMode = Manual - Default: 0
    • Add SetWheelWidth - Sets the width of an wheel, only working if WidthMode = Manual
    • Add get and set Events - Enables or disables the events
    • Haptic feedback disabled if you call Scroll2Index
    • BugFixes
WidthMode = Manual
You can now determine and divide the width of the wheels yourself.
For example, the 1st wheel has a width of 70% of the total width of the view, the 2nd wheel has the remaining 30%.
(2) image.png

B4X:
Private Sub B4XPage_Resize (Width As Int, Height As Int)
    If ASWheelPicker1.NumberOfLists = 2 Then 'To ensure that the code is not executed until the 2 wheels have been added
        ASWheelPicker1.SetWheelWidth(0,(Width*70)/100)'70% of total width
        ASWheelPicker1.SetWheelWidth(1,(Width*30)/100)'30% of total width
    End If
End Sub
Is compatible too with Separators
1639567950715.png

*Red = Separators
*Blue = Items
 

Lisa I

Member
Licensed User
I have your excellent ASwheelpicker library and wondered if you were aware of any issues with Android 12.
Unfortunately I don't have an Android 12 device yet, before I go out and purchase one for debugging I just wanted to check.

I have a customer whose app is crashing when he opens a page with wheelpickers on (it's working fine in Android 11), everything else in the app is working.

Thank you
Lisa

B4X:
TyreWheelPicker1.Curved = True
    TyreWheelPicker1.Cyclic = True
    TyreWheelPicker1.CurtainColor = Colors.ARGB(50, 100, 100, 100)
    TyreWheelPicker1.Curtain = True
    TyreWheelPicker1.ItemTextColor = Colors.Black
    TyreWheelPicker1.Atmospheric = True
    TyreWheelPicker1.ItemAlign = 0                     
    TyreWheelPicker1.ItemTextSize = 80
    TyreWheelPicker1.SelectedItemPosition = 0            
    TyreWheelPicker1.SelectedItemTextColor = Colors.Black
    TyreWheelPicker1.VisibleItemCount = 3
    TyreWheelPicker1.SameWidth = True
    tyrelist.Initialize
    tyrelist.AddAll(Array As String("ALL",0,1,2,3,4,5,6,7,8,9,10))
    TyreWheelPicker1.Data = tyrelist
 

Alexander Stolte

Expert
Licensed User
Longtime User
TyreWheelPicker1.Curved = True TyreWheelPicker1.Cyclic = True TyreWheelPicker1.CurtainColor = Colors.ARGB(50, 100, 100, 100) TyreWheelPicker1.Curtain = True TyreWheelPicker1.ItemTextColor = Colors.Black TyreWheelPicker1.Atmospheric = True TyreWheelPicker1.ItemAlign = 0 TyreWheelPicker1.ItemTextSize = 80 TyreWheelPicker1.SelectedItemPosition = 0 TyreWheelPicker1.SelectedItemTextColor = Colors.Black TyreWheelPicker1.VisibleItemCount = 3 TyreWheelPicker1.SameWidth = True tyrelist.Initialize tyrelist.AddAll(Array As String("ALL",0,1,2,3,4,5,6,7,8,9,10)) TyreWheelPicker1.Data = tyrelist
Thats not the ASWheelPicker, sorry.
 

astronald

Active Member
Licensed User
Longtime User
Hello, thanks for your work
I try implement ASwheel in B4I B4Xpages Dialog
in B4A work great but B4I fire this error

Error occurred on line: 368 (ASWheelPicker)
Object was not initialized (UIView)
-[b4i_customlistview _designercreateview:::] + 672
Thanks for your time and help
 
Top