Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Window 7 scaling issue (high DPI ?) on 125% display(SWT Button is not displayed fully on an editor when display is set to 125% on Windows 7)
Window 7 scaling issue (high DPI ?) on 125% display [message #1341922] Thu, 08 May 2014 18:19 Go to next message
Gidi Gal is currently offline Gidi Gal
Messages: 17
Registered: July 2009
Junior Member
Hello to all the forum members,

I am working on Windows 7 with Eclipse 4.3.2. I created an editor with some SWT widgets on it. It is displayed correctly when the display is set to 100%. When I set the display to 125% the last button on the right is not displayed fully. I uploaded screen-shots of both states.

If I understand correctly, this is related to "high DPI" subject.

If anyone knows of tips for writing SWT UI for better scaling when display is not set to 100%, or whether this is an issue (defect ? enhancement ?) with SWT\UI, I'll be grateful for your comments.

Thanks,
Gidi

Comment: unfortunetely, I could not download both screen-shot files I created, so I settled with the one showing the problem on 125%.

[Updated on: Thu, 08 May 2014 18:30]

Report message to a moderator

Re: Window 7 scaling issue (high DPI ?) on 125% display [message #1385582 is a reply to message #1341922] Mon, 09 June 2014 17:43 Go to previous message
Peter Morling is currently offline Peter Morling
Messages: 2
Registered: March 2014
Junior Member
Hi,

you should size the button acc. to the current font size. Se the following example:

// Button
final Button button = new Button(lower, SWT.PUSH);
button.setText("Ok");
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
// some action

}
});
final GC gc = new GC(button);
final Point size = gc.textExtent("0123456");
gc.dispose();
final GridData gdButton = new GridData();
gdButton.grabExcessHorizontalSpace = false;
gdButton.grabExcessVerticalSpace = false;
gdButton.heightHint = size.y + 8;
gdButton.widthHint = size.x + 33;
gdButton.horizontalAlignment = SWT.CENTER;
gdButton.verticalAlignment = SWT.CENTER;
button.setLayoutData(gdButton);

Best, Peter

Previous Topic:Security Issues in SWT 4.3 version for Windows and MAC
Next Topic:How to style the clickable part in the Link Control?
Goto Forum:
  


Current Time: Thu Oct 23 18:00:01 GMT 2014

Powered by FUDForum. Page generated in 0.01921 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software