Reputation: 45
How can I make Dialog Box to hide when user clicks anywhere outside Dialog Box?
It is a GWT application where a view is extending Dialog Box. I have a Close button in Dialog Box which OnClicked hides the Dialog Box. However, as per requirement, if user clicks anywhere outside the Dialog Box, it should hide.
Any help would be greatly appreciated.
Thanks
Upvotes: 2
Views: 770
Reputation: 3048
Use the constructor DialogBox(boolean autoHide)
or the setter setAutoHideEnabled(boolean autoHide)
in order to automatically hide the box when the user clicks outside of it.
You can also auto-hide on history token changes, using the setAutoHideOnHistoryEventsEnabled(boolean enabled)
setter.
Upvotes: 3