Bug 85998 - GridData SWT.CENTER not precise on Combo
Summary: GridData SWT.CENTER not precise on Combo
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.1   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords: ui
Depends on:
Blocks:
 
Reported: 2005-02-21 14:42 EST by Benjamin Pasero CLA
Modified: 2007-05-18 14:28 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Pasero CLA 2005-02-21 14:42:51 EST
Running the following Snippet, a Text and a Combo widget are shown in a
GridLayout side by side. Both are vertically centered, but the Text widget
begins at the same vertical position as the Combo, although the Combo is bigger
in height.

I checked the same Snippet on Windows, and there the Text widget is positioned
exactly between the Combo (=centered vertically).

public class Main {
  public static void main(String[] args) {
    System.setProperty("org.eclipse.swt.internal.carbon.noFocusRing", "true");
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new GridLayout(1, false));

    Composite c = new Composite(shell, SWT.BORDER);
    c.setLayout(new GridLayout(2, true));
    c.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

    Text t = new Text(c, SWT.BORDER);
    t.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    Combo co = new Combo(c, SWT.NONE);
    co.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    co.add("Hallo");

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

Note that the blue focusring was removed with a System Property. Not sure, but
maybe the removal is not taken into account when the preferred size is calculated?

Ben
Comment 1 Silenio Quarti CLA 2007-05-18 14:28:36 EDT
I could not reproduce this anymore. Please reopen if you still see the problem.