Skip to main content



      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 15:17
Eclipse UserFriend
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: Sat Jul 12 07:00:40 EDT 2025

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

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

Back to the top