B4A Library Spinner Wheel - Vertical and Horizontal (24 June: new lib files in post #47)

Marco Maria Vilucchi

Active Member
Licensed User
Longtime User
hi johan,
nice library.
I downloaded library and you project (b4aAndroidSpinnerWheel.zip )
IT WORKS......

Then i copied main.bal into files folder of my project and i create a new module in my project named sosti.
In sosti i copied all instructions of b4aAndroidSpinnerWheel main module and I call sosti from an activity in my project (StartActivity(Sosti))

When I call sosti I have always this error:

** Activity (homepage) Pause, UserClosed = false **
Activity Pause
** Activity (sosti) Create, isFirst = true **
Class not found: androidspinnerwheelwrapper.androidSpinnerWheelWrapper, trying: com.mamavi.holydiet.androidSpinnerWheelWrapper
sosti_activity_create (java line: 362)

the line is:
Activity.LoadLayout("main")

Someone can help me?
Thanks in advance
Marcom
 

Johan Schoeman

Expert
Licensed User
Longtime User
Have you copied the /Objects/res folder too? The are xml files in the folders that are required for the B4A project to work. These files must be set to READ ONLY
 

epiCode

Active Member
Licensed User
Hey Johan
Very nice looking spinner !!
I've Two queries?
1. It takes up a lot of space on screen ? can this be zoomed when activated then revert to a minimized icon ? I tried scaling it but it did not work.
2. Would it be possible if there is a timer which does not generate "selected" event in quick succession while user is viewing the options but gets activated once spinning stop or as defined duration after spinning stops to generate final selected value?
 

CaptKronos

Active Member
Licensed User
Longtime User
Just found this great view and have been playing around with the horizontal variant. I have noticed that the spinner's content isn't centred vertically and unfortunately the gravity setting isn't exposed for the horizontal variant, as it is for the vertical. To get around this I used:
B4X:
Sub vertCentreHorizWheel(whv As WheelHorizontalView)
    Dim r As Reflector
    r.Target=whv
    Sleep(0) 'not sure why, but without this sleep the following line results in r being set to null
    r.Target=r.GetField("mItemsLayout")
    r.SetField2("mGravity", Gravity.CENTER_VERTICAL)
    whv.setupSpinnerWheel
End Sub

Also, I found the following two helper functions useful and may address mohsyn's requirement #2:
B4X:
Sub getHorizWheelIndex(whv As WheelHorizontalView) As Int
    Dim r As Reflector
    r.Target=whv
    Return r.GetField("mCurrentItemIdx")
End Sub

Sub getHorizWheelItem(whv As WheelHorizontalView) As String
    Dim r As Reflector
    r.Target=whv
    r.Target=r.GetField("mViewAdapter")
    Dim s() As String=r.GetField("items")
    Return s(getHorizWheelIndex(whv))
End Sub
 

Guenter Becker

Active Member
Licensed User
Hi, well done work!

How is it possible to ad a Click or better long Click event to the view? Code Snipped would be good. Thank you.
 

Liew

Member
Licensed User
Longtime User
Hi Johan,
May I know how to put this example to work on b4xpages. I had tried it never works.
Thanks.
Regards,
Liew
 

MarcoRome

Expert
Licensed User
Longtime User
Hi Johan,
May I know how to put this example to work on b4xpages. I had tried it never works.
Thanks.
Regards,
Liew
Can you try:
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…