Dropdown List Example

ItWorks

Member
Licensed User
Longtime User
Hi Guys/Gals,

Still new to this but getting on fast.

Here is a little example of how I solved the need for a Dropdown list.

Can anyone explain to me what is happenning with ScrollView.ScrollPosition because I could not get it to work right until I added DoEvents in the right place, looks like a scrolllist needs time to move to the right position.

Anyway, hope you enjoy my little example.

ItWorks
 

Attachments

  • DropdownExample.zip
    7.9 KB · Views: 412

Informatix

Expert
Licensed User
Longtime User
Can anyone explain to me what is happenning with ScrollView.ScrollPosition because I could not get it to work right until I added DoEvents in the right place, looks like a scrolllist needs time to move to the right position.

Every time you change the position, you trigger an animation. That's why you have to wait. Sometimes, one DoEvents is not enough.
Here's a bit of code to wait until the scrolling animation ends (NewPosition is the position to reach):
B4X:
Dim PreviousPosition As Int: PreviousPosition = -1
Do Until PreviousPosition = sv.ScrollPosition
   PreviousPosition = sv.ScrollPosition
   sv.ScrollPosition = NewPosition
   DoEvents
Loop
 
Upvote 0

ItWorks

Member
Licensed User
Longtime User
hi Informatix,

Thanks for the code snippet.
I will try that tomorrow.
My eyes have gone now, staring at a screen all day.

Regards
ItWorks
 
Upvote 0
Top