Bug 558723 - Toolbar doesn't get visibile when setting inside setRedraw
Summary: Toolbar doesn't get visibile when setting inside setRedraw
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.14   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-02 06:16 EST by zzzz CLA
Modified: 2020-06-10 10:24 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zzzz CLA 2020-01-02 06:16:40 EST
When setting 'setVisible(true)' on a Toolbar inside a setRedraw, toolbar is never shown


Below the snippet, clicking on button will show the label, but not the toolbar.
Removing setRedraw false/true on toolbar, toolbar will show correctly



        Display display = Display.getDefault();

        Shell s = new Shell(display);
        s.setBounds(0, 0, 600, 400);

        Label lbl1 = new Label(s, SWT.NONE);
        lbl1.setText("label text");
        lbl1.setBounds(20, 20, 200, 30);
        lbl1.setVisible(false);

        ToolBar toolbar1 = new ToolBar(s, SWT.NONE);
        ToolItem toolItem = new ToolItem(toolbar1, SWT.PUSH);
        toolItem.setText("toolbar text");
        toolbar1.setBounds(300, 20, 200, 30);
        toolbar1.setVisible(false);

        Button b1 = new Button(s, SWT.PUSH);
        b1.setText("doit");
        b1.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                lbl1.setRedraw(false);
                lbl1.setVisible(true);
                lbl1.setRedraw(true);

                toolbar1.setRedraw(false);
                toolbar1.setVisible(true);
                toolbar1.setRedraw(true);
            }
        });
        b1.setBounds(20, 60, 200, 30);

        s.open();
        for( ;; ) {
            if( display.isDisposed() || s.isDisposed() )
                return;

            if( !display.readAndDispatch() )
                display.sleep();
        }