Whats wrong with the following tiny code using TreeEditor [message #528910] |
Thu, 22 April 2010 11:35 |
Missing name Mising name Messages: 10 Registered: February 2010 |
Junior Member |
|
|
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 ();
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.03448 seconds