[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[platform-swt-dev] strange things about TreeEditor !
|
hello all,
this is my code snippet;
import org.eclipse.swt.*;
import org.eclipse.swt.custom.TreeEditor;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.*;
public class Snippet {
static Display display = Display.getDefault();
final static Shell shell = new Shell(display);
final static Tree tree = new Tree(shell, SWT.BORDER |SWT.MULTI);
public static void main (String [] args) {
shell.setLayout(new FillLayout());
shell.open();
for (int i = 0; i < 3; i++) {
TreeItem item = new TreeItem(tree, SWT.NONE);
ProgressBar pb = new ProgressBar(tree, SWT.SMOOTH);
TreeEditor editor = new TreeEditor(tree);
editor.grabHorizontal = true;
editor.setEditor(pb, item);
item.setText("item " + i);
}
while(!shell.isDisposed())
if(!display.readAndDispatch())
display.sleep();
display.dispose();
}
}
-----------------------
I firstly open the shell , and after that I add three TreeEditors to the tree.but I found only the first TreeEditor with
the progressBar is visible . the other two will be visible until I
resize the shell. I only want to dymanicily add the TreeItem with a TreeEditor and a progressBar after the shell is opened .but i found only one TreeEdior can be seen . I have tried to add shell.redraw() or tree.redraw(),but it didn't work. who can tell me what is the problem ? and how can I achive the goal?
Thanks very much!!