Bug 561592

Summary: GTK3 Checkbox with label cut-off
Product: [Eclipse Project] Platform Reporter: Pascal Muetschard <pmuetschard>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: 4.15   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Screenshot of the snippet none

Description Pascal Muetschard CLA 2020-03-30 14:27:03 EDT
Created attachment 282278 [details]
Screenshot of the snippet

Consider the below snippet. When run, the two checkboxes should be identical, however, the second one has its label cut off. It appears to be the order in which the checkbox's checked state and label are set. If the label is set first, all is OK, if, however, the check state is set first, the label gets cut off.

This is with R-4.15-202003050155 (version 4.924)

Snippet:

  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new GridLayout(1, false));
    Button b1 = new Button(shell, SWT.CHECK);
    b1.setText("Hello World");
    b1.setSelection(true);

    Button b2 = new Button(shell, SWT.CHECK);
    b2.setSelection(true);
    b2.setText("Hello World");

    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    display.dispose();
  }