B4A Library WheelView Library

Deprecated ! see the updated version of Wheel as a class http://www.b4x.com/forum/basic4android-share-your-creations/18855-wheel-b4a-class.html#post108297
and the new Wheel https://www.b4x.com/android/forum/threads/a-new-wheelview.91645/post-578792


The Wheelview is a complex view, built on a scrollview with labels, and uses a timer to settle on the predefined values of the wheel.
The logic was first shared by birnesoft here http://www.b4x.com/forum/bugs-wishlist/14620-spin-wheel.html#post89984 and many members of the forum contributed to the improvement till we got a really nice tool.
I put the logic into a library, trying to ease the use for developers who don't have time to master the tricks there, but kept several options for personal look preferences, as well as leaving the cover on top to be done by the application.

Attached also a demo program.
Important note : The Tick events and the ReadWheel method are a must for the operation of the wheel.

Please try it and give comments for more functionality/improvements/bugs correction.
Thanks again to all the contibutors.

Edit: Updated to ver 1.1 with additional two methods for updating the values without need to re-initialize, by list or by array.
Also modified the name of SetValue to SetToValue to avoid misunderstandings about the functionality of the method.

Edit: - example app added to ver. 1.1
 
Last edited:

aardsoft

Member
Licensed User
Longtime User
I must be thick

I have downloaded both wheelview.zips and extracted. I load the project into Basic4Android. It doesn't run as it complains of a missing library reference for wheelview as a type.
Dim wv1,wv2,wv3 As WheelView
what am I doing wrong? I'm under the delusion that a demo should just download and run.
 

NJDude

Expert
Licensed User
Longtime User
I have downloaded both wheelview.zips and extracted. I load the project into Basic4Android. It doesn't run as it complains of a missing library reference for wheelview as a type.
Dim wv1,wv2,wv3 As WheelView
what am I doing wrong? I'm under the delusion that a demo should just download and run.

You need to download and install the library, it's attached on the first post.

You also have to reference that library in the B4A IDE.
 

AllanH

Member
Licensed User
Longtime User
Wheelview by library

Please take a look at "Wheel by B4A class" section
The mechanics of the wheelview are relatively small and I think better provided by a class that can be inherited/modified to specific requirements than a java library that only a few wise ones can tinker with. There is no real java-magic required.

BW

Allan
 

Johan Schoeman

Expert
Licensed User
Longtime User
I have been playing around with WheelView. When the app starts for the first time after installation the date in all three wheels (day of month, month, year) are correct. If you spin the wheels, close the app, and then start the app again then occasions the wheels do not have the correct info in them for the current day of month, month, and year. Anyone else came accross this and have a solution for it?
 

derez

Expert
Licensed User
Longtime User
It is a known problem of the wheel, in some applications it sometimes "does not start" until an event occures. Try to add several doevents after the wheel creation.
 

Johan Schoeman

Expert
Licensed User
Longtime User
Don't know if it id the right/correct solution but if you call "show_today" from SUB Activity_Resume (the only line of code that I have in this sub) then it seems to solve the problem. Have not had a failed start of day, month, year in any of the wheels despite numerous attempts.
 

derez

Expert
Licensed User
Longtime User
If it helps - then it is a good idea. In my devices the example works also in activity_create but I'll check it in other implementations.
 

Mashiane

Expert
Licensed User
Longtime User
I have 4 wheels in my control depending on each other. You select an item on the first wheel and the second wheel is updated, when the second is selected it updated the third and the fourth wheel and when the third is updated, the fourth gets updated. Im using the .UpdateList method for each wheel. This works fine however how do I set the wheen item displayed to be the first item on the wheel, currently they all display the last items.

I've tried to use .SetValueTo(0), assuming that 0 is the index of the first item in each wheel, however this is not working. Can you please advise?
 

derez

Expert
Licensed User
Longtime User
run the setvalueto from activity_resume, after the wheels have been initialized and set.
 
Top