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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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
|
|
| |
Goto Forum:
Current Time: Thu Apr 25 04:03:17 GMT 2024
Powered by FUDForum. Page generated in 0.03846 seconds
|