Initializing a dialog? [message #447279] |
Mon, 13 December 2004 02:00  |
Eclipse User |
|
|
|
Originally posted by: manish.garg.gmail.com
Hi,
I have case where I want to open a dialog and set some data in the text
fields.
My calls looks like the following.:
1. MyDialog dlg= new MyDialog (...);
2. dlg.initializeValues();
3, dlg.open();
I initialize the value through the method initializeValues on line 2.
However, the textbox which gets calls setEnabledOK() in the modifyListener
and at this point I get a nullPointerException. The setEnabledOK cannot be
called before dlg.open(). But setting the values in the textBox will cause
this to happen.
It looks like a common case and there must be a solutions to this so I hope
someone will reply.
thanks
Manish
p.s.: I cannot swap lines 2 and 3 because the dlg.initializeValues() will
not be called.
|
|
|
|
Re: Initializing a dialog? [message #447408 is a reply to message #447279] |
Tue, 14 December 2004 09:05  |
Eclipse User |
|
|
|
You can only access fields in the dialogs (e.g. with setTitle, setImage,
setText) between open() and closing the dialog. In case of modal dialogs
open() blocks until you close the dialog.
If you want to use Dialog or TitleAreaDialog for exmaple you would have
to override createDialogArea and (optional) createButtonBar which both
will be called when the dialog is opened.
yves
> Hi,
>
> I have case where I want to open a dialog and set some data in the text
> fields.
> My calls looks like the following.:
>
> 1. MyDialog dlg= new MyDialog (...);
> 2. dlg.initializeValues();
> 3, dlg.open();
>
> I initialize the value through the method initializeValues on line 2.
> However, the textbox which gets calls setEnabledOK() in the modifyListener
> and at this point I get a nullPointerException. The setEnabledOK cannot be
> called before dlg.open(). But setting the values in the textBox will cause
> this to happen.
>
> It looks like a common case and there must be a solutions to this so I hope
> someone will reply.
>
> thanks
> Manish
>
> p.s.: I cannot swap lines 2 and 3 because the dlg.initializeValues() will
> not be called.
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03310 seconds