[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: Controls on ScrolledComposite 'guzzles' events
|
Veronika Irvine schrieb:
For me, the mouse wheel events go to the widget with focus (not the widget
my cursor is over). If the widget with focus does not make use of the mouse
wheel events, the events are propogated up the parent heirarchy until a
widget does make use of them.
I've added a display.addFilter (SWT.MouseWheel, ...) to see what will
happen and remarked that some rotations doesn't produced any event,
although the inner Composite was beeing scrolled.
The problem with Labels is that they do not take focus. As a result,
another widget such as a button which does take focus will be getting the
mouse wheel events and the events will be going to the parent hierarchy of
the button rather than the label.
What I don't understand, is why does wheel-scrolling still works with
the "malicious" Control focussed, as long my mouse is over Composite or
scrollableComposite, although they do not have focus?
One workaround is to use Text with the style READ_ONLY instead of a Label.
The Text widget can take focus.
...and keeps it because Text is also scrollable. How do I can send an
Event to the parent manually, or tell Text to ignore the event? I'd
assumed "setCapture(false)" for this job, but...
I am still nearly as confused as at the beginning. :-/
For now I've worked aroud with an display.addFilter, and look whether
mouse is over my scrollableComposite:
display.addFilter(SWT.MouseMove, new Listener () {
public void handleEvent(Event e) {
Control p = (Control) e.widget;
while (p != null) {
if (p == scrollableComposite) {
p.setFocus();
break;
}
p = p.getParent();
}
}
});
This works satisfying, but I'm not sure whether this is a good approach.
A
P.S.
Veronika, as I see, you are the owner of this what I've commited as a
bug. If you like, I can send you a more illustating example.
--