Summary: | [browser] setVisible(true) does not work | ||
---|---|---|---|
Product: | [Eclipse Project] Platform | Reporter: | Akmal <as> |
Component: | SWT | Assignee: | Christophe Cornu <christophe.cornu+eclipse> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | major | ||
Priority: | P1 | ||
Version: | 3.0 | ||
Target Milestone: | 3.0 RC2 | ||
Hardware: | PC | ||
OS: | Linux-GTK | ||
Whiteboard: |
Description
Akmal
2004-05-25 13:53:11 EDT
Previous jface plugin sample can be reduced to the following SWT test: static int cnt = 0; public static void main0(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("PRBrowser"); shell.setLayout(new FillLayout()); TabFolder t = new TabFolder(shell, SWT.NONE); TabItem i1 = new TabItem(t, SWT.NONE); TabItem i2 = new TabItem(t, SWT.NONE); Button b = new Button(t, SWT.PUSH); final Browser browser = new Browser(t, SWT.NONE); b.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { browser.setText("<html><body>hello "+cnt+"</body></html>"); cnt++; } }); i1.setControl(b); i2.setControl(browser); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } } The bottom of the problem lies in setVisible which does not cause the browser to reappear and redraw without further resizing. public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("PRBrowser"); Button b = new Button(shell, SWT.PUSH); b.setBounds(0,0,100,50); final Button b2 = new Button(shell, SWT.TOGGLE); b2.setBounds(200,0,100,50); final Browser browser = new Browser(shell, SWT.NONE); browser.setBounds(100,100,200,200); b.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { browser.setText("<html><body>hello "+cnt+"</body></html>"); cnt++; } }); b2.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { boolean flag = b2.getSelection(); if (!flag) System.out.println("make browser visible "+flag); browser.setVisible(flag); } }); shell.setSize(400,400); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } } fixed v>20040603 |