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 226264 Details for
Bug 399370
Arrow Keys behavior differs between SWT/RWT for Radio Buttons (SWT.RADIO)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Workaround replacing the default arrow behavior
file_399370.txt (text/plain), 1.40 KB, created by
Sebastien Arod
on 2013-01-29 10:40:20 EST
(
hide
)
Description:
Workaround replacing the default arrow behavior
Filename:
MIME Type:
Creator:
Sebastien Arod
Created:
2013-01-29 10:40:20 EST
Size:
1.40 KB
patch
obsolete
>final List<Button> radioButtons = ... >KeyListener keyListener = new KeyAdapter() { > @Override > public void keyPressed(KeyEvent pE) { > Widget currentButton = (Button)pE.widget; > int currentButtonIdx = radioButtons.indexOf(currentButton); > Button nextButton = null; > int direction = 0; > if (pE.keyCode == SWT.ARROW_DOWN > || pE.keyCode == SWT.ARROW_RIGHT) { > // Go to next button > direction = 1; > } else if (pE.keyCode == SWT.ARROW_LEFT > || pE.keyCode == SWT.ARROW_UP) { > // Go to previous button > direction = -1; > } > if (direction != 0) { > // Find button to focus excluding disabled buttons > int newButtonIdx = currentButtonIdx; > do { > newButtonIdx += direction; > Button candidate = radioButtons.get(newButtonIdx > % radioButtons.size()); > if (candidate.isEnabled()) { > nextButton = candidate; > } > } while (newButtonIdx != currentButtonIdx > && nextButton == null); > if (nextButton != null) { > nextButton.setFocus(); > } > } > } >}; >for (Button button : radioButtons) { > button.setData(RWT.CANCEL_KEYS, new String[] { > "ARROW_LEFT", "ARROW_UP", "ARROW_RIGHT", "ARROW_DOWN" }); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$ > button.setData(RWT.ACTIVE_KEYS, new String[] { > "ARROW_LEFT", "ARROW_UP", "ARROW_RIGHT", "ARROW_DOWN" }); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$) > button.addKeyListener(keyListener); >}
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 399370
:
226247
| 226264