Skip to main content



      Home
Home » Eclipse Projects » NatTable » Using Combo as CellEditor - deselect value
Using Combo as CellEditor - deselect value [message #1470332] Wed, 12 November 2014 03:57 Go to next message
Eclipse UserFriend
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 04:04 Go to previous messageGo to next message
Eclipse UserFriend
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 04:25 Go to previous messageGo to next message
Eclipse UserFriend
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 04:36 Go to previous message
Eclipse UserFriend
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: Sun Jul 06 13:15:07 EDT 2025

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

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

Back to the top