Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Window.OK != SWT.OK
Window.OK != SWT.OK [message #439862] Mon, 19 July 2004 09:29 Go to next message
Juergen Weber is currently offline Juergen WeberFriend
Messages: 56
Registered: July 2009
Member
Hi,

I wrote a jFace.Dialog.

OK-ing the Dialog results in org.eclipse.jface.dialogs.Dialog.okPressed()
which sets a return code of Window.OK which finally is the result code of
Dialog.open()

Well, I naively checked Dialog.open() == SWT.OK

SWT.OK = 1 << 5

Window.OK = 0;

This seems a bit unfortunate to me.

Juergen
Re: Window.OK != SWT.OK [message #439932 is a reply to message #439862] Mon, 19 July 2004 16:41 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
They are not part of the same package and were developed independently.
It's too bad but can never be changed (binary compatibility).

"Juergen Weber" <weberjn@yahoo.com> wrote in message
news:cdg49t$r03$1@eclipse.org...
> Hi,
>
> I wrote a jFace.Dialog.
>
> OK-ing the Dialog results in org.eclipse.jface.dialogs.Dialog.okPressed()
> which sets a return code of Window.OK which finally is the result code of
> Dialog.open()
>
> Well, I naively checked Dialog.open() == SWT.OK
>
> SWT.OK = 1 << 5
>
> Window.OK = 0;
>
> This seems a bit unfortunate to me.
>
> Juergen
>
Re: Window.OK != SWT.OK [message #634440 is a reply to message #439932] Thu, 21 October 2010 17:34 Go to previous messageGo to next message
Parvez Ahmad Hakim is currently offline Parvez Ahmad HakimFriend
Messages: 31
Registered: May 2010
Member
try below
String newName = newNameText.getText();
if(newName.trim().length()>0 && (!newName.equals(oldName))){
setReturnCode(FormDialog.OK);
setNewName(newNameText.getText());
close();
}else{
form.setText("Invalid input. Please enter a new name");
}


Parvez Ahmad Hakim
India
Re: Window.OK != SWT.OK [message #634520 is a reply to message #634440] Fri, 22 October 2010 05:41 Go to previous message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
On 21.10.2010 19:34, Parvez Ahmad Hakim wrote:
> try below
> String newName = newNameText.getText();
> if(newName.trim().length()>0 && (!newName.equals(oldName))){
> setReturnCode(FormDialog.OK);
> setNewName(newNameText.getText());
> close();
> }else{
> form.setText("Invalid input. Please enter a new name"); }

Yep, you have to take care on your own. SWT.OK is a bitmask
constant. You can 'or it with other constants to form a set
that describe a set of buttons that shall be shown in a
MessageBox dialog.

Window.OK is just a symbolic constant for a particular
integral value useable as a return value to describe success
of opening a window.

Thus, both values have a complete different meaning.

HTH & Greetings from Bremen,

Daniel Krügler
Previous Topic:Will Apple allow SWT on their new Mac App Store?
Next Topic:Polygon Figure with gradient pattern ,does not paint properly at different zooms.
Goto Forum:
  


Current Time: Sat Aug 24 03:06:22 GMT 2019

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

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

Back to the top