B4A Library Wheel by B4A Class

The new version 2 is amazing !
Here is the wheel library converted to b4a class at a very short time, and with better handling and options for the user/developer.

Documentation is within the class, a demo program is running the class - all very simple.

Applause to Erel :icon_clap:

Edit: updated to include a ReadWheel method, which I found necessary as well.
SetByIndex corrected to refer to the original array index.

Edit: Ver 2 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...:(

Edit: 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
Edit: Ver 2.2 enables definition of cyclic property in the designer. The text property may include 0,1 or 2 parameters, as defined in the following table:
table.png

Edit: Horizontal WheelView added, with the same properties. The table above refer to Width instead of Height.
Edit: Both vertical wheel and horizontal wheel were updated to use resumeable subs.

Note: The wheel is very sensitive to delay parameter (when setting it to show a value). You have to check the performance with Release mode.
 

Attachments

  • scsh.png
    scsh.png
    34.7 KB · Views: 1,752
  • Hscreen.png
    Hscreen.png
    21.6 KB · Views: 537
  • wheelview_3.zip
    18.3 KB · Views: 182
  • HWheelView_3.zip
    14.3 KB · Views: 146
Last edited:

Djembefola

Active Member
Licensed 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
B4A ver. 1.9

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

derez

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

Dario126

Member
Licensed 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
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
+ 1 :sign0087:
 

derez

Expert
Licensed 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
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
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
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
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: 128

luke2012

Well-Known Member
Licensed 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.

Outstanding ! :)

I'll try! If you wish you can send the entire zip to my eMail (I send you a private message) :)
 
Last edited:
Top