Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 228900 Details for
Bug 75766
Allow mouse wheel to scroll without focus
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
EasyScroll - class for mouse wheel scrolling without manual focusing
file_75766.txt (text/plain), 2.46 KB, created by
Tolya Vasiliev
on 2013-03-22 02:39:24 EDT
(
hide
)
Description:
EasyScroll - class for mouse wheel scrolling without manual focusing
Filename:
MIME Type:
Creator:
Tolya Vasiliev
Created:
2013-03-22 02:39:24 EDT
Size:
2.46 KB
patch
obsolete
>import org.eclipse.swt.SWT; >import org.eclipse.swt.custom.ScrolledComposite; >import org.eclipse.swt.widgets.Composite; >import org.eclipse.swt.widgets.Control; >import org.eclipse.swt.widgets.Event; >import org.eclipse.swt.widgets.Group; >import org.eclipse.swt.widgets.Listener; > >/** > * This class allows vertical mouse wheel scrolling without manual focus > * It works with ScrolledComposite and sets focus to first control in child Composite > * of ScrolledComposite with MouseEnter event (only if any of Composite controls not focused yet) > */ >public class EasyScroll { > > /** > * @param scrolledComposite Target ScrolledComposite > * @param setVerticalIncrementValue Allows setting vertical bar increment value > * > */ > public static final void addEasyMouseWheelScroll( > final ScrolledComposite scrolledComposite, boolean setVerticalIncrementValue) { > if (setVerticalIncrementValue) > scrolledComposite.getVerticalBar().setIncrement(5); > > final ScrollControl scrollControl = new ScrollControl(); > > // Getting child composite of ScrolledComposite > Composite childComposite = null; > if (scrolledComposite.getChildren()[0] instanceof Composite) > childComposite = (Composite) scrolledComposite.getChildren()[0]; > > childComposite.addListener(SWT.MouseEnter, new Listener() { > public void handleEvent(Event e) { > if (!scrollControl.isAnotherControlInFocus) > scrolledComposite.setFocus(); > } > }); > > scrollControl.checkControlsOnScroll(childComposite); > } > >} > >/** > * Need to control scrolling > */ >class ScrollControl { > boolean isAnotherControlInFocus = false; > > /** > * Correcting some bug with wrong focusing > * @param composite > */ > public void checkControlsOnScroll(Composite composite) { > for (final Control control : composite.getChildren()) { > if (control instanceof Composite || control instanceof Group) { > checkControlsOnScroll((Composite) control); > } else { > control.addListener(SWT.MouseDown, new Listener() { > public void handleEvent(Event e) { > control.addListener(SWT.MouseExit, new Listener() { > public void handleEvent(Event e) { > control.setFocus(); > isAnotherControlInFocus = true; > control.removeListener(SWT.MouseExit, this); > } > }); > control.addListener(SWT.FocusOut, new Listener() { > public void handleEvent(Event e) { > isAnotherControlInFocus = false; > } > }); > } > }); > > } > } > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 75766
:
63769
|
90888
| 228900