Reputation: 618
I'm using SWT table which consists of one column and i'm using SWT TableEditor to edit the column values.
When i try to edit a particular row, only the text of that particular TableItem gets selected.
Is there any way to enable the entire selection of that Table item.
My selectionListner code for the table looks like this:
final TableEditor editor1 = new TableEditor(table);
//The editor must have the same size as the cell and must
//not be any smaller than 50 pixels.
editor1.horizontalAlignment = SWT.LEFT;
editor1.grabHorizontal = true;
editor1.minimumWidth = 130;
final int keyEditableColumn = 0;
table.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e)
{
// Clean up any previous editor control
Control oldEditor = editor1.getEditor();
if (oldEditor != null) oldEditor.dispose();
// Identify the selected row
final TableItem item = (TableItem)e.item;
if (item == null)
{
return;
}
// The control that will be the editor must be a child of the Table
Text newEditor = new Text(table, SWT.NONE);
//Adding the list of Text Widgets that have been created for a component.
textWidgetsList.add(newEditor);
newEditor.setText(item.getText(keyEditableColumn));
newEditor.addModifyListener(new ModifyListener()
{
public void modifyText(ModifyEvent me)
{
.....
.....
.....
.....
.....
}
});
newEditor.selectAll();
newEditor.setFocus();
editor1.setEditor(newEditor, item, keyEditableColumn);
}
});
Please let me know your suggestions....
Upvotes: 0
Views: 445