View Full Version : The method getHideButton() is undefined for the type Dialog

28 Feb 2014, 8:53 AM
missing this method:
problem in code :

box.addHideHandler(new HideHandler() {

public void onHide(HideEvent event) {
Dialog btn = (Dialog) event.getSource();
if (PredefinedButton.valueOf(btn.getHideButton().getItemId()).equals(PredefinedButton.YES))

Colin Alworth
28 Feb 2014, 12:20 PM
As documented in the release notes and in Dialog's Javadoc, there is now a better event to get these details from called DialogHideEvent. With this event, it isn't necessary to track the last button used to hide the dialog. Several reasons this is a good thing:
* Hard to tell if a dialog was hidden via hide(), since that means no button
* The button returned from getHideButton() had to be checked to see if it had a certain string to decide on what action to take instead.

Release notes excerpt:

Removed Window.hide(TextButton) and Window.getHideButton(), these capabilities are now provided by the derived class, e.g. Dialog.addDialogHideHandler() and DialogHideEvent.getHideButton()
Added Dialog.getButton(PredefinedButton) as an alternative to Dialog.getButtonById(String)

Example from dialog javadocs:

dialog.addDialogHideHandler(new DialogHideHandler() {
public void onDialogHide(DialogHideEvent event) {
// Invoke event.getHideButton() and take action based on value of returned enum

1 Mar 2014, 5:13 AM
That's what I was looking for... Thanks!

17 Jul 2014, 1:30 AM
Just the tip I needed too - also thanks!