B4A Library Wheel by B4A Class

Djembefola

Active Member
Licensed User
Longtime User
a beautiful view, great for user input! Entering numbers by user interaction always works fine, but setting a value programatically can lead to unexpected results: the displayed value differs from the value, which was passed by the method call (often, not always).

I could not dive deep into the program logic, just tested the view with three wheels (each with a range of 0-9). When i tried to set the three wheels programatically to 1 0 0, sometimes 190 or 200 or 101 or 099 was displayed.
 

luke2012

Well-Known Member
Licensed User
Longtime User
B4A ver. 1.9

Hi to all,
The Wheel class is supported in the version 1.9 of B4A?
 

derez

Expert
Licensed User
Longtime User
No, the classes were introduced to b4a in version 2.0
You can use the wheel library instead.
 

Dario126

Member
Licensed User
Longtime User
I have tried WheelClassMod1.1 but on compilation of included example B4A (v2.3) returns following error:
"Error parsing program .. unknown type reflector .. are you missing library reference? .. Occurred on line 95: Dim r as Reflector"

What am I missing?
 
Last edited:

derez

Expert
Licensed User
Longtime User
Ver 2 (in the first post) can be used as custom view (starting b4a ver. 2.71) and also by code definition. If by designer - define the size of wheel, the properties of the text and then by code use "SetObject" to input the numbers of the wheel. The height of the internal labels is by default 1/3.2 of the view's height, or the "Text" field if you want it otherwise (or change by code using "SetStep").
If defined by code you have to use "initialize", then "CodeCreationView" and then add the view to its parent. In that case several display parameters are the defaults but can be changed by property subs.
To my opinion - it is much easier to define the wheel now by the designer (thanks Erel !). I wish it was possible to read the color of the lbl but it is writeable only...
 

GMan

Well-Known Member
Licensed User
Longtime User
+ 1 :sign0087:
 

derez

Expert
Licensed User
Longtime User
I found a go around solution to define the color of the wheel as the color of the custom view in the designer, attached as ver. 2.1 in the first post.
 

moster67

Expert
Licensed User
Longtime User
derez:

I have a scrollview where I have positioned a label.When the user clicks on the label, I am opening a panel where the wheel is located. The problem is that when I try to use the wheel, it does not always "roll" because the underlying scrollview starts to scroll/roll as well.

I have tried to resolve this issue by requesting focus of the panel and it works better but still there are problems depending in which direction I am rolling the wheel.

Any idea how I can resolve this?

Thanks.
 

derez

Expert
Licensed User
Longtime User
Not sure if I fully understand the setup, but it seems that you have to prevent the touch event from beeing read by the scrollview. You can do it by making the panel (on which the wheel is placed) full screen size (or at least cover the scrollview size), and have an empty sub to catch the panel's touch event.
 

luke2012

Well-Known Member
Licensed User
Longtime User
Hi @derez.
First of all my compliments!

Is it possible to implement a horzontal wheel (one row) to select a number from a range (ex. 1 to 10) ?
 

derez

Expert
Licensed User
Longtime User
It is possible. I did it long time ago for pictures display, and it is attached. You'll have either to modify the vertical wheel to horizontal by changing the axes or re-adapt the attached to text instead of photos.
Sorry - due to size limit I had to remove the pictures from the files directory - you should add yours and modify the code accordingly.
 

Attachments

  • horizontalwheel.zip
    10.1 KB · Views: 244

luke2012

Well-Known Member
Licensed User
Longtime User

Outstanding !

I'll try! If you wish you can send the entire zip to my eMail (I send you a private message)
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…