Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Rap ComboBox selection handling
icon11.gif  Rap ComboBox selection handling [message #1415194] Tue, 02 September 2014 09:35 Go to next message
Florian Makowski is currently offline Florian MakowskiFriend
Messages: 5
Registered: July 2014
Junior Member
Hey guys,

i am currently using a "org.eclipse.swt.widgets.Combo" in my application and now i am trying to implement an keyboard support for my widgets. now my problem is that i want to trigger an event if an element in the combobox is selected.

in the past i used a selectionlistener to trigger it, when it have been clicked with the mouse. Now when i enter by tab and try to go through the elements by the arrow keys, the listener things that i want to select the object by pressing the arrow key.

are there any solutions to force the listener to wait until i pressed like enter or tab?


Greetz
Re: Rap ComboBox selection handling [message #1415209 is a reply to message #1415194] Tue, 02 September 2014 10:17 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2334
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi,
you could use event.button field to distinguish selection event by
keyboard from mouse. See this snippet:
-----------------
Combo combo = new Combo( parent, SWT.NONE );
combo.setItems( new String[] { "a", "b", "c" } );
combo.addListener( SWT.Selection, new Listener() {
@Override
public void handleEvent( Event event ) {
if( event.button == SWT.NONE ) {
System.out.println( "selection by keyboard" );
} else {
System.out.println( "selection by mouse" );
}
}
} );
combo.addListener( SWT.DefaultSelection, new Listener() {
@Override
public void handleEvent( Event event ) {
System.out.println( "selection by enter" );
}
} );
------------

HTH,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Rap ComboBox selection handling [message #1415245 is a reply to message #1415209] Tue, 02 September 2014 11:56 Go to previous messageGo to next message
Florian Makowski is currently offline Florian MakowskiFriend
Messages: 5
Registered: July 2014
Junior Member
hey thx for your fast answere gonna try it Smile
Re: Rap ComboBox selection handling [message #1415249 is a reply to message #1415245] Tue, 02 September 2014 12:09 Go to previous message
Florian Makowski is currently offline Florian MakowskiFriend
Messages: 5
Registered: July 2014
Junior Member
its working thx Smile
Previous Topic:Nebula grid repo RAP 2.3 requires RAP 3.0
Next Topic:Display.getDefault() returns null
Goto Forum:
  


Current Time: Tue Feb 25 16:14:14 GMT 2020

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

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

Back to the top