While using ListBox, I suddenly discovered that using the mousewheel to scroll would result in double scrolling (~7 items instead of ~3.5).
Debugging, I noticed that apart from the call to ViewPort::mouseWheelMove, there was an additional call to ListBox::mouseWheelMove afterwards.
Checking with the juce demo, I was able to pinpoint the behavior to setting ListBox::setMouseMoveSelectsRows(true).
I tried it both with ListBox (FontsAndTextDemo) and TableListBox (TableDemo).
No… I think you’re misunderstanding that. The Viewport gets the wheel event first, but if it uses it, then it doesn’t pass it on. If it doesn’t need the event, then it does pass it on and the ListBox gets it. I can’t see a code path where the same event would be used twice.
Odd. It does use a mouse listener, and looking at the code, I don’t think that’s necessary so I’ll remove it. But… I couldn’t find any situation where it used the same mouse-wheel event twice, so I’m not sure what it is that you’re doing to trigger a problem?
Try adding the line listBox->setMouseMoveSelectsRows(true); to FontsAndTextDemo and then scroll the fonts list.
You’ll notice it scrolls twice as many rows.
Same goes for table.setMouseMoveSelectsRows(true); for TableDemo.