Listbox.MouseWheel: scroll exactly one row at a time

Hello all.

Any idea how to make Listbox to scroll one row at a time? I’ve tried to play with Listbox.MouseWheel and ScrollPosition with no luck.

Did you read ?

http://documentation.xojo.com/index.php/ListBox.ScrollPosition
http://documentation.xojo.com/index.php/RectControl.MouseWheel

Yes of course. I put this code in the event to increase/decrease the ScrollPosition by 1.

me.ScrollPosition = me.ScrollPosition + (deltaY/Abs(deltaY))
Return True

The behavior still increases/decreases by 2 rows. Am I miss something?

How many times is it called?

You might use a timer to record when it has scrolled once, and not allow more scrolling until some period of time has passed.

Yes, you’re right. Putting code to prevent the event is called twice fix the issues. Thank you.