Community
Participate
Working Groups
To make a dialog non-modal we currently have to override setShellStyle. @Override protected void setShellStyle(int newShellStyle) { super.setShellStyle(SWT.CLOSE | SWT.MODELESS | SWT.BORDER | SWT.TITLE); setBlockOnOpen(false); } Unfortunately this will make the dialog still sit on top of the application window. AFAIK we currently have no way to make a dialog a top-level shell, e.g., so that I switch between the dialog and the application window with Ctrl+tab.
Stefan / Alex / Dani, any suggestion how to archive this via new or existing API?
> AFAIK we currently have no way to make a dialog a top-level shell, e.g., > so that I switch between the dialog and the application window with Ctrl+tab. If you give it a null parent and make it non-modal, it should end up as a top-level shell. We reparent modal dialogs to prevent deadlocks.
(In reply to Stefan Xenos from comment #2) > > AFAIK we currently have no way to make a dialog a top-level shell, e.g., > > so that I switch between the dialog and the application window with Ctrl+tab. > > If you give it a null parent and make it non-modal, it should end up as a > top-level shell. > > We reparent modal dialogs to prevent deadlocks. But as Lars said, you need to override setShellStyle() for this. Checking the sources of org.eclipse.jface.dialogs.Dialog you will notice that SWT.APPLICATION_MODAL is set always.
But AFAIK you don't need to override setShellStyle. Most existing dialogs that wish to change the style bits do something like this in their constructor: setShellStyle(getShellStyle() | SWT.RESIZE); So if you want to make a nonmodal top-level dialog, you could do this: public MyDialog() { super((Shell) null); setShellStyle(SWT.CLOSE | SWT.MODELESS | SWT.BORDER | SWT.TITLE); } Is there something I'm missing? Is there a reason why this either doesn't work, is undesirable, or is too verbose?