• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Default windows font size effects layout

 
Kelly Wiles
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have looked on Google but can not find answer or I can't word it correctly to find it.

When I develop a SWT application my computers desktop font size is set to windows 7 default size.
I mainly use Form layout with Grid layout for some windows.

My problem is that when the program is run on a windows system and the user has increased the font size of the desktop my layouts are all messed up.
If I go into windows settings and reset the font back to the default size everything looks fine again.

I have tried using setFont on all the widgets but it does not effect this problem.

What can I do about desktop font size being changed from the default?
Have attached an example image of the problem.

Thanks
example.jpg
[Thumbnail for example.jpg]
example of increased font size
 
Tony Docherty
Bartender
Posts: 2988
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've not used SWT and also without seeing the code this is all a bit of a guess but I suspect the problem is because you are specifying the exact dialog size rather than letting the dialog auto calculate the ideal size based on the components preferred sizes. In Swing you would do this using pack(), not sure what the equivalent is for SWT.
 
Kelly Wiles
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried what you suggested and here are the results.

I use a simpler screen than the configuration screen shown but still has the same problem.

The first image login1.png is how it should look.
The second image login2.png is after I removed the setSize call.
And the third image login3.png shows what happens after I add the pack() call.

I use Window Builder Pro and that GUI builder does not add pack() calls to the code generated.

If using pack() is part of the answer then I am doing something else wrong.
login1.png
[Thumbnail for login1.png]
What it normally looks like.
login2.png
[Thumbnail for login2.png]
After removing setSize call
login3.png
[Thumbnail for login3.png]
After adding pack call
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic