|
Re: Return code of window.open() [message #443695 is a reply to message #443694] |
Wed, 29 September 2004 12:01 |
Eclipse User |
|
|
|
Originally posted by: l.heisterkamp.web.de
Looks good to me...
Are you sure you don't have a semicolon after your if line?
if (returnCode == Window.OK);
//here --^
That would cause this behaviour.
Regards,
LH
In article <cje6m9$fbm$1@eclipse.org>, OIe.Laurisch@NOSPAMt-systems.com
says...
> Hello everybody,
>
> I have a dialog MyDialog which extends Dialog. If I open it like this
>
> MyDialog myDialog = new MyDialog();
> myDialog.setBlockOnOpen(true);
> if (myDialog.open() == Window.OK)
> {
> //do something
> }
>
> the if-clause returns true no matter whether I click OK in the dialog or the
> small 'x' in the upper right corner of the dialog.
>
> If I do something like this
>
> MyDialog myDialog = new MyDialog();
> myDialog.setBlockOnOpen(true);
> int returnCode = myDialog.open():
> System.out.println(returnCode);
> if (returnCode == Window.OK)
> {
> //do something
> }
>
> the System.out statement prints a '1' if I click on the 'x' and and '0'
> otherwise. But independent of this, the programm enters the then-part of the
> if-clause.
>
> Can anyone explain this behaviour?
>
> Ole
>
>
>
|
|
|
|
Re: Return code of window.open() [message #443701 is a reply to message #443697] |
Wed, 29 September 2004 13:16 |
Eclipse User |
|
|
|
Originally posted by: l.heisterkamp.web.de
> Unbelievable! How did you know?
> In fact there was a semicolon. And I have been debugging for half an hour...
>
> Thanks!
> Ole
;-)
In eclipse you can enable a warning to prevent such a situation:
set
Window->Preferences->Java->Compiler->Style->Empty statement
to "Warning"
Regards,
LH
|
|
|
|
Powered by
FUDForum. Page generated in 0.03185 seconds