Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 333934

Summary: the widgets at the bottom of the dialog only show half in Chinese version of win7, but fully in XP.
Product: [Eclipse Project] Platform Reporter: popjxc <popjxc>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: major    
Priority: P3 CC: eclipse.felipe, popjxc, remy.suen
Version: 3.6.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug
Attachments:
Description Flags
swt dialog.
none
jface dialog
none
Snippet with problem in Chinese version of windows 7.
none
Previous attachment running snap shot none

Description popjxc CLA 2011-01-10 21:39:49 EST
I develop a RCP on windows XP, but when run on Chinese version of windows 7, some dialogs are showed incomplete. Usually, the widgets at the bottom of the dialog only show half, the other half were hidden because the dialog not big enough.

The problem happens on Chinese version of windows 7, all the dialogs in my xp are displayed OK, but failed in Chinese version of windows 7. 

And I try to change resolution of XP and win7, At all resolution xp performs ok, but win7 failed.

All the layout and dialog(both swt and jface) have the same problem.
Comment 1 popjxc CLA 2011-01-10 21:41:19 EST
Created attachment 186455 [details]
swt dialog.

swt dialog.
Comment 2 popjxc CLA 2011-01-10 21:45:38 EST
Created attachment 186456 [details]
jface dialog

jface dialog which have the problem.

In fact, you design a dialog that compact in xp,it will incomplete in Chinese version of win 7.
Comment 3 Remy Suen CLA 2011-01-11 06:16:13 EST
*** Bug 333933 has been marked as a duplicate of this bug. ***
Comment 4 Felipe Heidrich CLA 2011-01-11 09:56:11 EST
Can you provide another test case ?

- If possible, something a lot simpler (just a main method, no references to JFACE). See one of our snippets as a template:  http://www.eclipse.org/swt/snippets/

- The test case you attached does not have Chinese in it. Note, that Chinese string should be encoded in code using the \uxxxx notation.

Quickly looking at th code I would say the problem is either here:
static final int COMBO_HEIGHT = 25;
or here:
protected Point getInitialSize() {
	return new Point(400, 300);
}

These values for height can be good for XP, but bad for Windows 7. Try changing these values and see if the problem goes away.
Comment 5 popjxc CLA 2011-01-11 22:38:37 EST
> - The test case you attached does not have Chinese in it. Note, that Chinese
> string should be encoded in code using the \uxxxx notation.

This problem has no relation with Chinese Characters, but Chinese version of OS. I don't have a win7 system now, so I will provide a snippet some hours later.
Comment 6 popjxc CLA 2011-01-11 22:50:49 EST
(In reply to comment #5)
> > - The test case you attached does not have Chinese in it. Note, that Chinese
> > string should be encoded in code using the \uxxxx notation.
> 
> This problem has no relation with Chinese Characters, but Chinese version of
> OS. I don't have a win7 system now, so I will provide a snippet some hours
> later.


I change the old problem swt dialog to a snippet, I don't test it in win7 yet. But I am sure there is problem when I extend swt dialog.

public class Snippet2 {
	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);

		shell.setSize(314, 192);
		shell.setText("SWT Dialog final");
		shell.setLayout(new FormLayout());

		Composite composite = new Composite(shell, SWT.NONE);
		FormData fd_composite = new FormData();
		fd_composite.left = new FormAttachment(0, 10);
		fd_composite.top = new FormAttachment(0, 10);
		fd_composite.right = new FormAttachment(0, 298);
		composite.setLayoutData(fd_composite);

		Composite composite_1 = new Composite(shell, SWT.NONE);
		fd_composite.bottom = new FormAttachment(composite_1, -6);

		Combo combo = new Combo(composite, SWT.NONE);
		combo.setBounds(10, 10, 87, 20);

		Combo combo_1 = new Combo(composite, SWT.NONE);
		combo_1.setBounds(10, 36, 87, 20);

		Combo combo_2 = new Combo(composite, SWT.NONE);
		combo_2.setBounds(10, 62, 87, 20);

		Combo combo_3 = new Combo(composite, SWT.NONE);
		combo_3.setBounds(10, 86, 87, 20);
		FormData fd_composite_1 = new FormData();
		fd_composite_1.top = new FormAttachment(0, 122);
		fd_composite_1.bottom = new FormAttachment(100, -4);
		fd_composite_1.left = new FormAttachment(0, 10);
		fd_composite_1.right = new FormAttachment(100, -10);
		composite_1.setLayoutData(fd_composite_1);

		Button button = new Button(composite_1, SWT.NONE);
		button.setBounds(206, 10, 72, 22);
		button.setText("New Button");

		Button button_1 = new Button(composite_1, SWT.NONE);
		button_1.setBounds(121, 10, 72, 22);
		button_1.setText("New Button");

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




problem dialog :

public class SwtTest3 extends Dialog {

	protected Object result;
	protected Shell shlSwtDialogFinal;

	/**
	 * Create the dialog.
	 * @param parent
	 * @param style
	 */
	public SwtTest3(Shell parent, int style) {
		super(parent, style);
		setText("SWT Dialog");
	}

	/**
	 * Open the dialog.
	 * @return the result
	 */
	public Object open() {
		createContents();
		shlSwtDialogFinal.open();
		shlSwtDialogFinal.layout();
		Display display = getParent().getDisplay();
		while (!shlSwtDialogFinal.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
		return result;
	}

	/**
	 * Create contents of the dialog.
	 */
	private void createContents() {
		shlSwtDialogFinal = new Shell(getParent(), getStyle());
		shlSwtDialogFinal.setSize(314, 192);
		shlSwtDialogFinal.setText("SWT Dialog final");
		shlSwtDialogFinal.setLayout(new FormLayout());
		
		Composite composite = new Composite(shlSwtDialogFinal, SWT.NONE);
		FormData fd_composite = new FormData();
		fd_composite.left = new FormAttachment(0, 10);
		fd_composite.top = new FormAttachment(0, 10);
		fd_composite.right = new FormAttachment(0, 298);
		composite.setLayoutData(fd_composite);
		
		Composite composite_1 = new Composite(shlSwtDialogFinal, SWT.NONE);
		fd_composite.bottom = new FormAttachment(composite_1, -6);
		
		Combo combo = new Combo(composite, SWT.NONE);
		combo.setBounds(10, 10, 87, 20);
		
		Combo combo_1 = new Combo(composite, SWT.NONE);
		combo_1.setBounds(10, 36, 87, 20);
		
		Combo combo_2 = new Combo(composite, SWT.NONE);
		combo_2.setBounds(10, 62, 87, 20);
		
		Combo combo_3 = new Combo(composite, SWT.NONE);
		combo_3.setBounds(10, 86, 87, 20);
		FormData fd_composite_1 = new FormData();
		fd_composite_1.top = new FormAttachment(0, 122);
		fd_composite_1.bottom = new FormAttachment(100, -4);
		fd_composite_1.left = new FormAttachment(0, 10);
		fd_composite_1.right = new FormAttachment(100, -10);
		composite_1.setLayoutData(fd_composite_1);
		
		Button button = new Button(composite_1, SWT.NONE);
		button.setBounds(206, 10, 72, 22);
		button.setText("New Button");
		
		Button button_1 = new Button(composite_1, SWT.NONE);
		button_1.setBounds(121, 10, 72, 22);
		button_1.setText("New Button");

	}
	
	public static void main(String[] args) {
		new SwtTest3(new Shell(),SWT.CLOSE).open();
	}
}
Comment 7 popjxc CLA 2011-01-12 08:56:52 EST
Created attachment 186629 [details]
Snippet with problem in Chinese version of windows 7.

Now I test this snippet in win 7,There is no space between each combo in Vertical,
But about 5 pixels in XP.
Comment 8 popjxc CLA 2011-01-12 09:00:05 EST
Created attachment 186630 [details]
Previous attachment running snap shot

FYI
Comment 9 Felipe Heidrich CLA 2011-01-12 17:08:03 EST
As far as I can tell the bug is in the layout used in the snippet. The composite is not tall enough.
Changing 
fd_composite.bottom = new FormAttachment(composite_1, -6);
to 
fd_composite.bottom = new FormAttachment(composite_1, 0);
already made the bottom of the last combo to work for me.

Other problem I see in the code is that all combos have a fixed height of 20 pixels. On a Chinese system, where the default font is different (probably larger than the default font in English system) this 20 pixels might not be the right size (possibibly too small).
Comment 10 Lars Vogel CLA 2019-09-24 13:51:33 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.