Sheet Support in SWT
Join the DZone community and get the full member experience.Join For Free
So what is a Sheet?
A Sheet is essentially a Dialog, which is tied to a parent window. It acts as a Modal Dialog, so the user cannot perform any operations on a window until the Dialog is dismissed. (He is free to work on other windows) The dialog is
- always attached with the window until dismissed
- placed in the center of the window
- moves along when the window is moved
- Use Sheets when the interaction is very short like the question "Is Eclipse a cool product? ". Opening a 15 step Wizard to choose your life partner is not right place to use Sheet.
- Do not use Sheets where the user might still need to interact with the Window (like copy something from window and paste it in the Sheet). Since Sheets are Window Modal, it doesn't allow the user to interact with the associated Window
- Sheets are not Application Modal. So if you want a dialog to be Application Modal, don' use Sheets
- Unlike normal Dialogs, Sheets do not have title. Avoid Sheets where title provides valuable information.
- Do not use nested Sheets (says Apple's UI guidelines)
How do I use Sheet?
Simple. Set the SWT.Sheet style to the Shell of the dialog. In case you are using the MessageDialog, pass on the style bit as the last argument to the MessageDialog.open() method
Opinions expressed by DZone contributors are their own.