Hi - this one is driving me mad. Can anyone help verify what I am seeing here…
There seems to be a bug with the ListBox (cocoa) when it tries to scroll the list… It’s random but easy to reproduce on my Mac at least. (10.8.4).
Try this and let me know what you see…
Create a new desktop project.
On the new window drop on a listbox control
At an open event to the listbox and then add some code to add 20 rows - sequentially numbered 0 - 19
Dim i As Integer
for i = 0 to 19
Me.AddRow(Str(i))
next
Adjust the size of the listbox control so that you can only see the first 10 lines - (Height = 183 worked well to demonstrate the problem in my project).
Run the app…
Select row 0 from the list.
XX Now - scroll the list ALL THE WAY to the bottom so that you can no longer see the selected row.
Use the down arrow key to move the selection…
If the list selection moves to row 1 and this row is displayed at the very top of the list - then things are all as expected… carry on.
Go back to Step XX above and repeat… i.e scroll to the bottom of the list and then hit down key
Under normal circumstances you should hop sequentially down the list
BUT what I am seeing is that quite often the list selection is incremented but the scroll position is messed up… Instead of going from say row 4 to 5 with 5 being nicely displayed at the top - the list box will hop randomly to the bottom of the list…
It does this in the reverse also.
So - the questions are;
a) Can anyone else reproduce this?
b) Am I going mad?
b) any ideas on how to address this?
Thanks for the reply.
How about this…
When I said, “scroll to the bottom of the list” - are you using the mouse and click-dragging the scrollbar knob to the bottom OR (and this might be the variation) are you using the 2 finger scroll gesture with the trackpad?
I see expected, consistent behaviour when click-dragging the knob BUT NOT when I’ve used the gesture.
Plus, I’ve reproduced it with RB 2011 - with and without any plugins…
I can reproduce this and think it’s the trailing effects of mouse wheeling. I noticed it happened only when pressing down soon after scrolling. Changing to 200 lines it’s more noticeable. Select the top row, flick towards the bottom and quickly press down. It Immediately jumps up to the selected line but continues scrolling downwards and fading to a stop.
This post wheel motion is called momentum and with declares it’s possible to tell if a MouseWheel event is normal or one of these momentums. I did this once but it was involved and may not have worked perfectly. If this is your problem I don’t know how else to fix it but declares.