[Java-gnome-developer] Grabbing default in a subclass of Dialog
Brought to you by:
afcowie
From: Richard S. <ri...@r-...> - 2010-08-10 09:15:18
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm trying to create dialogs with default buttons but I can't get them to work. I've subclassed org.gnome.gtk.Dialog and used addButton() in the constructor like this: Button applyButton = new Button(Stock.APPLY); addButton(Stock.CLOSE, ResponseType.CLOSE); addButton(applyButton, ResponseType.APPLY); applyButton.setCanDefault(true); applyButton.grabDefault(); But when I show the dialog and press return, the default button isn't activated? I tried exposing the button from the dialog class with a getter method and calling dialog.getDefaultButton().grabDefault() after I'd shown the dialog but that doesn't seem to work either. Am I missing something? - -- Regards, Richard -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkxhGJ8ACgkQdPdD0eWqTe7VywCgtKe+f3nvF5V9aXajaJg2QVHE i9oAoMaioq+D3kwhem95m0iAofVcXtKo =Pp9U -----END PGP SIGNATURE----- |