| 
| WizardDialog default button [message #332810] | Mon, 10 November 2008 11:24  |  | 
| Eclipse User  |  |  |  |  | Originally posted by: eclipse-news.rizzoweb.com 
 Is there any way, from my Wizard class, to remove the "default button"
 designation from the WizardDialog's "Finish" button? I need to
 circumvent the behavior of the wizard doing its finish work when the
 Enter key is pressed.
 
 Thanks in advance,
 Eric
 |  |  |  | 
|  | 
| 
| Re: WizardDialog default button [message #332822 is a reply to message #332812] | Mon, 10 November 2008 15:37   |  | 
| Eclipse User  |  |  |  |  | Originally posted by: eclipse-news.rizzoweb.com 
 On 11/10/2008 11:44 AM, Remy Chi Jian Suen wrote:
 > Eric Rizzo wrote:
 >> Is there any way, from my Wizard class, to remove the "default button"
 >> designation from the WizardDialog's "Finish" button? I need to
 >> circumvent the behavior of the wizard doing its finish work when the
 >> Enter key is pressed.
 >
 > IWizardContainer container = wizard.getContainer();
 > Shell shell = container.getShell();
 > shell.setDefaultButton(null);
 
 Remy,
 I already looked at that, but the comments for setDefaultButton() say:
 
 * If the argument is not null, sets the receiver's default
 * button to the argument, and if the argument is null, sets
 * the receiver's default button to the first button which
 * was set as the receiver's default button (called the
 * <em>saved default button</em>).
 
 Since the default button is set by WizardDialog, it can't be set back to
 null. Worse, WizardDialog has code that explicitly sets the default
 button whenever a page is re-validated - arrrrgh!
 
 Eric
 |  |  |  | 
|  | 
| 
| Re: WizardDialog default button [message #334733 is a reply to message #332822] | Wed, 25 February 2009 10:37  |  | 
| Eclipse User  |  |  |  |  | Eric, we faced the same problem today on IRC, and we looked at the code. 
 If set to null, it actually apparently works so the API looks wrong here
 (or there is a bug in the code).
 
 So the fix here is to subclass DialogWizard, override updateButtons in
 WizardDialog and do getShell().setDefaultButton(null);
 
 It only works if you are in control when creating the DialogWizard.
 
 
 Thanks,
 
 Antoine
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.06853 seconds