Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Propagate / Forward MouseEvents and scrolling to parent
Propagate / Forward MouseEvents and scrolling to parent [message #900068] Fri, 03 August 2012 19:17
Tamer  is currently offline Tamer Friend
Messages: 3
Registered: December 2011
Junior Member
Hi All,

I answered my own question but thought I'd share it on the newsgroup in
case someone encounters a similar problem in the future.

Problem was:
I had an editor with a TreeViewer. It was scrolling fine.
Then I decided to put the TreeViewer inside a ScrolledForm to improve
the look and feel.
Once I did that, scrolling no longer works.

The Fix:
You need to forceFocus() on the parent form and fire a MouseWheel event
on it.

// Forward scrolling events to parent so that the form can be scrolled
viewer.getControl().addListener(SWT.MouseWheel, new Listener() {
@Override
public void handleEvent(Event event) {
form.forceFocus();
form.notifyListeners(SWT.MouseWheel, event);
}
});

Hope this helps!

Cheers,
Tamer
Previous Topic:How to disable user editing/typing in a combo box editor in a table?
Next Topic:Text vs. StyledText screen updates
Goto Forum:
  


Current Time: Mon Dec 22 13:00:54 GMT 2014

Powered by FUDForum. Page generated in 0.04455 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software