Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Help needed with TreeEditor


Hi All,

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.

(Note: I do not want the TreeEditor to come up only when some one clicks. 
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.

Regards
Techieeeee


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 ();
}
}


Back to the top