Community
Participate
Working Groups
We have a problem right now in Eclipse where a detach window can be resized to a small dot. We would like to control the resize so that it stops at a minimum size. The detach window does not have a title bar (if it did, we would get this behavior for free on windows). The title bar is not there because it was confusing to the user seeing what looked like two title bar in a detached window. I could not find any api to do this. There is a resize callback, but at that point the shell is already resized. Is it valid in the resize callback to force the shell height/width back to a minimum? I've not tried this but I would suspect it may have a weird ui effect. ----- Reply from Veronika... I can't see any other way to limit the size of the shell given the current API. You can change the size in the resize callback. There is a slght flash as the size bounces but for now that is all that I think you can do. I will run it past Steve when he gets back from OOPSLA. public static void main (String [] args) { Display display = new Display (); final Shell shell = new Shell (display); shell.setLayout(new GridLayout()); Button b = new Button(shell, SWT.PUSH); b.setText("Open Dialog ..."); b.addListener(SWT.Selection, new Listener(){ public void handleEvent (Event e) { final Shell dialog = new Shell(shell, SWT.SHELL_TRIM); dialog.addListener(SWT.Resize, new Listener() { public void handleEvent(Event e) { Point size = dialog.getSize(); if (size.x < 100 || size.y < 100) { dialog.setSize(new Point (Math.max(size.x, 100), Math.max(size.y, 100))); } } }); dialog.open(); } }); shell.open (); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); }
We should be using the platform to set the minimum (and maximum) size for a shell.
We could consider adding Shell.get/setMinimumSize(). SSQ, your thoughts? This is a really old (but non-critical) bug report.
We should do this.
Fixed > 20040910 See Shell.setMinimumSize().