Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Whats wrong with the following tiny code using TreeEditor
Whats wrong with the following tiny code using TreeEditor [message #528910] Thu, 22 April 2010 11:35
Missing name Mising name is currently offline Missing name Mising nameFriend
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 ();
}
}
Previous Topic:Strange error on Mac OS X 10.6 (Snow Leopard) with SWT 3.5 (Cocoa) - SOLVED
Next Topic:setSelection in TableViewer unable to select row from non-UI thread.
Goto Forum:
  


Current Time: Thu Apr 25 04:09:13 GMT 2024

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

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

Back to the top