Community
Participate
Working Groups
Build Identifier: M20100211-1343 I have a dialog box with a Table and a Button. There are enough rows in the table to cause pack() to size the box to it's vertical maximum. However, when the box is sized vertically, the screen space taken up by the Windows task bar is not taken into account, so there is a space at the bottom of the dialog that is hidden underneath the task bar. If the dialog is moved slightly above the top of the screen, you can see part of the bottom of the dialog, but most users simply get frustrated. Pack() should assume that the vertical (or horizontal, if the task bar is on the right or left edge) is not part of the visible area when computing the maximum size. This behavior happens on XP, Vista and Windows 7. Reproducible: Always Steps to Reproduce: 1. run test case 2. press open button 3. note that dialog, even when moved to the top, is not completely visible.
Created attachment 175898 [details] Test case
I reported this a couple of months ago. I'm starting to get a lot of customer complaints since they often have to resize dialog boxes to be able to see the buttons on the bottom. I wanted to see if someone could take a look at it.
Hi, sorry for the delayed answer. Things are pretty busy around here. I finally had a change to take a lot at your snippet. The problem is in the application code. You can't expect shell.pack() to cap the size of the shell to the client area of the display. That is not what it does. The table in the shell has 1000 items it forces pack size of the shell to be over 1400px in height (windows caps the size of the shell to the bounds of the display, but that is platform behaviour - you should not relie on that neither). For your code to work as you expect you should, remove: shell.pack(); and add: Point size = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT); Rectangle maxSize = shell.getDisplay().getClientArea(); if (size.x > maxSize.width) size.x = maxSize.width; if (size.y > maxSize.height) size.y = maxSize.height; shell.setSize(size);