Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Why must press "Enter" for ComboBoxCellEditor?
Why must press "Enter" for ComboBoxCellEditor? [message #510162] Tue, 26 January 2010 10:08 Go to next message
Eclipse User
Originally posted by: yoduderoo.netscape.net

Hi,
I have a table with ComboBoxCellEditor cells. When the user selects an
option from the drop-down list, theuser must then press "Enter".

Is there a way to use ComboBoxCellEditor such that the user must not
press "Enter". That is, the selection is equivalent to select+enter?

Thanks, y
Re: Why must press "Enter" for ComboBoxCellEditor? [message #511006 is a reply to message #510162] Fri, 29 January 2010 09:10 Go to previous messageGo to next message
Eclipse User
Originally posted by: yoduderoo.netscape.net

I solved it by the following, although I am not sure if it is the
"right" way:

Control control = comboboxEditor.getControl();
CCombo c = (CCombo) control;
c.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) { }
public void widgetSelected(SelectionEvent e) {
doSomething();
}
});

Yodude wrote:
> Hi,
> I have a table with ComboBoxCellEditor cells. When the user selects an
> option from the drop-down list, theuser must then press "Enter".
>
> Is there a way to use ComboBoxCellEditor such that the user must not
> press "Enter". That is, the selection is equivalent to select+enter?
>
> Thanks, y
Re: Why must press "Enter" for ComboBoxCellEditor? [message #514879 is a reply to message #511006] Tue, 16 February 2010 19:12 Go to previous messageGo to next message
Eric Jain is currently offline Eric Jain
Messages: 266
Registered: July 2009
Senior Member
Eclipse User wrote on Fri, 29 January 2010 09:10
Originally posted by: yoduderoo.netscape.net

I solved it by the following, although I am not sure if it is the
"right" way:

Control control = comboboxEditor.getControl();
CCombo c = (CCombo) control;
c.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) { }
public void widgetSelected(SelectionEvent e) {
doSomething();
}
});



This works, but you can no longer use the up/down keys to select menu items.

Note that instead of doSomething, you can also call comboboxEditor.deactivate() and keep all the logic to handle the change in EditingSupport.setValue(...).
Re: Why must press "Enter" for ComboBoxCellEditor? [message #514882 is a reply to message #514879] Tue, 16 February 2010 19:24 Go to previous message
Eric Jain is currently offline Eric Jain
Messages: 266
Registered: July 2009
Senior Member
See also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=285612
Previous Topic:How to control a TableViewer's size?
Next Topic:Adding a MouseTrackListener to a TreeViewerColumn
Goto Forum:
  


Current Time: Mon Jul 28 16:35:20 EDT 2014

Powered by FUDForum. Page generated in 0.12815 seconds