I want to create a few fancy things on 2nd level tree items.
(i.e. on every item which comes below the root level tree items).
However, the TreeEditor doesn't seem to work in the following small code.
Please help.
I want the fancy items (and hence the TreeEditor) to be there right when the user expands the root items).
Also, the fancy items component should stretch horizontally and mask all the columns present in its own row.
class test {
public test () {
Display display = new Display ();
Shell shell = new Shell (display);
shell.setLayout(new FillLayout());
final Tree tree = new Tree (shell, SWT.BORDER);
for (int i=0; i<4; i++) {
TreeItem iItem = new TreeItem (tree, 0);
iItem.setText ("TreeItem (I) -" + i);
for (int j=0; j<4; j++) {
TreeItem jItem = new TreeItem (iItem, 0);
jItem.setText ("TreeItem (J) -" + j);
TreeEditor editor = new TreeEditor (tree);
Text text = new Text (tree, SWT.NONE);
text.setText ("Junk.....");
editor.setEditor (text, jItem);
text.selectAll ();
text.setFocus ();
editor.layout ();
}
}
shell.setSize (200, 200);
shell.open ();
while (!shell.isDisposed()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
}