I'm trying to disable a shell in SWT using
sell.setEnabled(false);
this is working fine, I want to prevent user from doing actions, but in the same time I want to allow him to minimize the shell. The problem is that setEnabled(false)
will disable the entire shell.
Have you please an idea about that?
I guess you want to disable the content of the shell. Then why don't you just add a container (Composite) as the main content in the shell and disable/enable it as desired?. That won't affect the shell and, therefore, the minimize button will keep working.
final Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
final Composite composite = new Composite(shell, SWT.NONE);
composite.setEnabled(false);
Instead of disabling the Shell itself, disable the controls that it contains. Something like this:
Control[] children = shell.getChildren();
for( Control control : children ) {
control.setEnabled( false );
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.