java - SWT disable window causes lose focus -
i'm making custom dialogs want pop , disable main shell behind cannot clicked while dialog active.
my initial plan follows:
shell.setenabled(false); dodialogstuff(); shell.setenabled(true);
this worked close dialog, loses focus of shell open before dialog. managed sort of fix adding
shell.setfocus();
after last line messy , causes screen flicker window loses , gains focus in split second, also, doesn't regain focus , can't understand why :/
is there better way disable background window without losing focus.
thanks in advance peeps
you should create custom dialog based on this tutorial.
this way have set modality of dialog whatever need , dialog take care of rest you.
this should helpful (javadoc of shell
):
the modality of instance may specified using style bits. modality style bits used determine whether input blocked other shells on display.
primary_modal
style allows instance block input parent.application_modal
style allows instance block input every other shell in display.system_modal
style allows instance block input shells, including shells belonging different applications.
Comments
Post a Comment