Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » how to disable the ok button which is shown in dialog box
how to disable the ok button which is shown in dialog box [message #289718] Wed, 10 August 2005 09:04 Go to next message
Eclipse UserFriend
Originally posted by: vmadurai.orangescape.com

Actually I created a dialog box which extends the Dialog class,in that
dialog box i want to diable the OK button,i dont know how to do this,

coding which i used was,

getButton(IDialogConstants.OK_ID).setEnabled(false); -->it throws null
pointer exception

and i used

getButtonBar(),getShell().getDefaultButton() --> all this also
throws null pointer exception.

kindly help me to achieve this,

thanks in advance
vivek
Re: how to disable the ok button which is shown in dialog box [message #289726 is a reply to message #289718] Wed, 10 August 2005 10:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: callum.devnet-uk.net

I did this with Cancel button the following code:

protected void createButtonsForButtonBar (Composite parent)
{
createButton (parent, IDialogConstants.OK_ID, "Ok", true) ;
}


So you override that method and only create the button(s) you wish.
Assuming you use the correct ID, then you Cancel button will work fine.
Re: how to disable the ok button which is shown in dialog box [message #289739 is a reply to message #289718] Wed, 10 August 2005 14:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

"Vivekanandan Madurai" <vmadurai@orangescape.com> wrote in message
news:ddcftd$1gn$1@news.eclipse.org...
> Actually I created a dialog box which extends the Dialog class,in that
> dialog box i want to diable the OK button,i dont know how to do this,
>
> coding which i used was,
>
> getButton(IDialogConstants.OK_ID).setEnabled(false); -->it throws null
> pointer exception
>

You cannot call this method until after the button bar has been created.
i.e., if you try to call it in the createDialogArea(), it will throw a NPE.
So, either:
a) Override createButtonBar() and after super.createButtonBar(), disable the
OK button.
or
b) Override create() and after super.create(), disable the OK button.
---
Sunil
Re: how to disable the ok button which is shown in dialog box [message #289859 is a reply to message #289739] Thu, 11 August 2005 15:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vmadurai.orangescape.com

Sunil Kamath wrote:
> "Vivekanandan Madurai" <vmadurai@orangescape.com> wrote in message
> news:ddcftd$1gn$1@news.eclipse.org...
>
>>Actually I created a dialog box which extends the Dialog class,in that
>>dialog box i want to diable the OK button,i dont know how to do this,
>>
>>coding which i used was,
>>
>>getButton(IDialogConstants.OK_ID).setEnabled(false); -->it throws null
>>pointer exception
>>
>
>
> You cannot call this method until after the button bar has been created.
> i.e., if you try to call it in the createDialogArea(), it will throw a NPE.
> So, either:
> a) Override createButtonBar() and after super.createButtonBar(), disable the
> OK button.
> or
> b) Override create() and after super.create(), disable the OK button.
> ---
> Sunil
>
>
>
thank u sunil,but if i override the createButtonBar method,it creates
another set of buttons and it work properly,but old set of buttons is
not removed,i dont know how to remove the old set of buttons.please
reply me to do this,

thanks
vivek
Re: how to disable the ok button which is shown in dialog box [message #289863 is a reply to message #289859] Thu, 11 August 2005 15:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

"Vivekanandan Madurai" <vmadurai@orangescape.com> wrote in message
news:ddfpp1$mp3$2@news.eclipse.org...
> Sunil Kamath wrote:
>> "Vivekanandan Madurai" <vmadurai@orangescape.com> wrote in message
>> news:ddcftd$1gn$1@news.eclipse.org...
>>
>>>Actually I created a dialog box which extends the Dialog class,in that
>>>dialog box i want to diable the OK button,i dont know how to do this,
>>>
>>>coding which i used was,
>>>
>>>getButton(IDialogConstants.OK_ID).setEnabled(false); -->it throws null
>>>pointer exception
>>>
>>
>>
>> You cannot call this method until after the button bar has been created.
>> i.e., if you try to call it in the createDialogArea(), it will throw a
>> NPE.
>> So, either:
>> a) Override createButtonBar() and after super.createButtonBar(), disable
>> the OK button.
>> or
>> b) Override create() and after super.create(), disable the OK button.
>> ---
>> Sunil
>>
>>
>>
> thank u sunil,but if i override the createButtonBar method,it creates
> another set of buttons and it work properly,but old set of buttons is not
> removed,i dont know how to remove the old set of buttons.please
> reply me to do this,
>
If you don't want the default set of buttons, don't call
super.createButtonBar()
---
Sunil
Re: how to disable the ok button which is shown in dialog box [message #294658 is a reply to message #289718] Tue, 15 November 2005 19:39 Go to previous message
JavaJ Missing name is currently offline JavaJ Missing nameFriend
Messages: 45
Registered: July 2009
Member
I'm sure you've figured it out by now, but do like the one guy said, overwrite create(), call super.create then after put getButton(IDialogConstants.OK_ID).setEnabled(false);
Previous Topic:Team API questions
Next Topic:Decorator class stays null
Goto Forum:
  


Current Time: Thu Apr 25 04:03:17 GMT 2024

Powered by FUDForum. Page generated in 0.03846 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top