Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Using Combo as CellEditor - deselect value
Using Combo as CellEditor - deselect value [message #1470332] Wed, 12 November 2014 08:57 Go to next message
Björn Seebeck is currently offline Björn SeebeckFriend
Messages: 9
Registered: April 2012
Junior Member
How can I deselect a value (setting to null) in a combobox used as cell editor (non multi-select)?

Re: Using Combo as CellEditor - deselect value [message #1470338 is a reply to message #1470332] Wed, 12 November 2014 09:04 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2809
Registered: July 2012
Senior Member
IIRC you need to add an empty value to the combo that can be selected. Or try to make an editable combo that allows to manually modify an entry in the text component
Re: Using Combo as CellEditor - deselect value [message #1470366 is a reply to message #1470338] Wed, 12 November 2014 09:25 Go to previous messageGo to next message
Björn Seebeck is currently offline Björn SeebeckFriend
Messages: 9
Registered: April 2012
Junior Member
Hi Dirk, thanks for quick response.
Adding an empty entry would be anoying in our case, but I found a working solution for us by adding a key listener to Combo so the selection is set to null if user strikes DEL or BACKSPACE key:

		final ComboBoxCellEditor editor = new ComboBoxCellEditor(dataProvider) {
			@Override
			protected void addNatComboListener(final org.eclipse.nebula.widgets.nattable.widget.NatCombo combo) {
				super.addNatComboListener(combo);
				combo.addKeyListener(new KeyAdapter() {

					@Override
					public void keyPressed(KeyEvent event) {
						if (event.keyCode == SWT.DEL || event.keyCode == SWT.BS) {
							combo.setSelection(new String[] { "" });
						}
					}

				});
			}
		};
Re: Using Combo as CellEditor - deselect value [message #1470376 is a reply to message #1470366] Wed, 12 November 2014 09:36 Go to previous message
Björn Seebeck is currently offline Björn SeebeckFriend
Messages: 9
Registered: April 2012
Junior Member
FreeEdit did the trick.... so we set freeedit to true and can forget the upper workaround.
Previous Topic:NatTabel sort failing
Next Topic:Freezing several rows --> Collapse/Expand Root Node --> duplicate rows
Goto Forum:
  


Current Time: Mon Apr 12 04:22:41 GMT 2021

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

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

Back to the top