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

Alexander Stolte

Expert
Licensed User
Longtime User
This is a big update, which improves a lot of things. It is now even easier to use the view.
Update
  • 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
LazyLoading
The view now uses the LazyLaoding technique, you don't have to do anything, the view handles this internally automatically.
The advantage is, there are no performance problems with many items.

New Type ASWheelPicker_Item
Now you have the possibility to personalize the items.
Each item you add to the list gets its own object. This allows you to personalize each item individually.
Example:
B4X:
    Dim tmp_lst As List : tmp_lst.Initialize
    For i = 0 To 50 -1
        Dim Item As ASWheelPicker_Item
        Item.Initialize
        Item.Text = "Test " & i
        Item.Value = i
       
        Item.ItemTextProperties = ASWheelPicker1.ItemTextProperties
        Item.ItemTextProperties.TextColor = Rnd(0x8fffffff, -1)
       
        tmp_lst.Add(Item)
    Next
    ASWheelPicker1.AddItems(tmp_lst)

GetSelectedItem is now easier
In the past, you had to parse a map. Now you just get back an ASWheelPicker_Item Type.
Add and edit items
2 New functions that allow you to either add a new wheel or update an existing wheel.
AddItems - This function simply adds another wheel
SetItems - With this function you can either add a new wheel, or update an already existing wheel
-If the specified index is greater than the wheels that already exist, a new wheel is added
-If the specified index is smaller, the wheel at the index is populated with the new list

Exmaples:
Add a new Wheel with simple items:
B4X:
    Dim tmp_lst As List : tmp_lst.Initialize
    For i = 0 To 50 -1
        tmp_lst.Add("Test " & i)
    Next
    ASWheelPicker1.AddItems(tmp_lst)
Add a new Wheel with some complex values and design changes:
B4X:
    Dim tmp_lst As List : tmp_lst.Initialize
    For i = 0 To 50 -1
        Dim Item As ASWheelPicker_Item
        Item.Initialize
        Item.Text = "Test " & i
        Item.Value = i
       
        Item.ItemTextProperties = ASWheelPicker1.ItemTextProperties
        Item.ItemTextProperties.TextColor = Rnd(0x8fffffff, -1)
       
        tmp_lst.Add(Item)
    Next
    ASWheelPicker1.AddItems(tmp_lst)

A backup of the old version is available in the 1st post.
 

Alexander Stolte

Expert
Licensed User
Longtime User
A new view, based on the ASWheelPicker
 

davemorris

Active Member
Licensed User
Longtime User
Hi, Can some help

I have just donated and picked up a copy of ASWheelPicker - run-up the examples "AS_WheelDateTimePicker Example" and "AS WheelPicker Example" and the work. Unfortunately, "AS WheelPicker PlusMinus Example" does not even compile - I assume it's an old version.

I have a very simple requirement of editing previously stored times which are displayed in format as HH:MM:SS or MM:SS.DD (depending on configuration). It is a B4A and B4I application and I want to prevent users making mistakes when entering time by a utilizing a wheelPicker (so this library looks great).

I do have some questions
1. Is there any documentation on v3.00, I can only find some on v2.05.
2. I want to set the picker at the preloaded time (not 00:00) but can't find a method, it appears for v2.05 Scroll2Index() is used but I can't find it in ASWheelPicker v3.00.

I have only just started using ASWheelPicker, so I am still getting my head around the code and how it fits together. I started by trying to adapt the "AS_WheelDateTimePicker Example" but I am now considering using the ASWheelPicker class directly as it appears to expose more public methods.

Can someone help?

Dave Morris
 

Alexander Stolte

Expert
Licensed User
Longtime User
For this requirement the new View WheelDateTimePicker is perfect, I extend the library to the methods you need.

The documentation has been updated to V3.1.

Alex
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 3.01
    • Add GetItem
WheelDateTimePicker has been updated to version 1.2 and needs the latest version of WheelPicker.
2. I want to set the picker at the preloaded time (not 00:00) but can't find a method, it appears for v2.05 Scroll2Index() is used but I can't find it in ASWheelPicker v3.00.
B4X:
AS_WheelDateTimePicker1.Hour = 4
AS_WheelDateTimePicker1.Minute = 30
 

davemorris

Active Member
Licensed User
Longtime User
Hi Guys

Simple question how do you set the separator text color, I have tried

Private ASWheelPicker1 As ASWheelPicker
'
'
ASWheelPicker1.SeperatorProperties.TextColor = xui.Color_Black


And it appears to remain the default color

Thanks for the help
Dave
 

davemorris

Active Member
Licensed User
Longtime User
Hi, Thanks for update - the set Seperator color works.

Sorry to be a pain, how can I increase the size of the item text?

The Separators have a TextSize property, which works as show below
Change separator size:
    For i = 0 To ASWheelPicker1.NumberOfSeperators - 1
        ASWheelPicker1.GetSeperator(i).TextColor = xui.Color_Black   
        ASWheelPicker1.GetSeperator(i).TextSize= 20
    Next
Unfortunately, I can't find a similar method to change item text size (and the designer Text Properties > Size appears to have no effect).
I have looked thro' the previous posts (unless I missed it) and I can't find a question on this subject (which is surprising).

Regards
Dave
 

Alexander Stolte

Expert
Licensed User
Longtime User
Sorry to be a pain, how can I increase the size of the item text?
It is only possible to change items properties if you add them to the list afterwards or update the list.
B4X:
    Dim tmp_lst As List : tmp_lst.Initialize
    For i = 0 To 50 -1
        Dim Item As ASWheelPicker_Item
        Item.Initialize
        Item.Text = "Test " & i
        Item.Value = i
        
        Item.ItemTextProperties = ASWheelPicker1.ItemTextProperties
        Item.ItemTextProperties.TextFont = xui.CreateDefaultBoldFont(20)'changes the text size and font
        
        tmp_lst.Add(Item)
    Next
Add this list as new wheel with ASWheelPicker1.AddItems(tmp_lst) or to a existing wheel with ASWheelPicker1.SetItems(2,tmp_lst)
 

davemorris

Active Member
Licensed User
Longtime User
Hi, Alex

Thanks changing the text size, using your suggestion worked great - Sorry I simply misunderstood the funtionality of the textFont property - I was looking for the textSize.

Thanks for your help
Dave Morris
 

davemorris

Active Member
Licensed User
Longtime User
Hi
Just tried to use ASWheelPicker under B4i and it complains about Pan_Attributes Query missing library reference, can you help?

Problem code:
#Else If B4I

Private Sub gr_pan(state As Int, att As Pan_Attributes)
    'Log("att.X: " & att.X)
    Dim bb As GestureRecognizerWheelPicker = Sender
    Dim sv As ScrollView = bb.mView
    Dim xclv As CustomListView = lst_xclvs.Get(sv

Note: I am currently using v3.02 (just noticed you have released version 3.03 - would switching to this version fix the problem?)

Kind regards
Dave Morris
 

Alexander Stolte

Expert
Licensed User
Longtime User
why do you use the .bas file instead of the b4xlib?
In the b4xlib is everything what the lib. needs.
You are missing the GestureRecognizer which is in the b4i folder of the lib.
 

tsteward

Well-Known Member
Licensed User
Longtime User
Is there a way to change the colour of the currently selected item on a wheel?
I'm looking at creating a view with 10 columns/wheels, all columns will hold the values 1, 2, 3, 4
If the difference between two side by side columns is greater than 2 I want to set the later column text to Red
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…