Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » focuslistener and buttons don't mix?
focuslistener and buttons don't mix? [message #446177] Fri, 19 November 2004 04:07 Go to next message
Pierce is currently offline PierceFriend
Messages: 42
Registered: July 2009
Member
I have a dialog that implements the focuslistener interface, and I cannot
add a focuslistener to a button in the dialog. The error I get says
"The method AddFocusListener(FocusListener) in the type Control is not
applicable for the arguments(NewPatientDialog).

The code is pretty straightforward:
public class NewPatientDialog extends Dialog implements SelectionListener,
FocusListener {

...
m_clearFields = new Button(btnComposite, SWT.PUSH);
m_saveDefaults = new Button(btnComposite, SWT.PUSH);
m_clearFields.setText(NLSStrings.getString("clearFieldsBtnLabel "));

m_saveDefaults.setText(NLSStrings.getString("saveDefaultsBtnLabel "));
m_clearFields.addSelectionListener(this);
m_clearFields.addFocusListener(this); // unhappy here
m_saveDefaults.addSelectionListener(this);
m_saveDefaults.addFocusListener(this); // unhappy here as well

...
}

Any thoughts?

--PK
Re: focuslistener and buttons don't mix? [message #446179 is a reply to message #446177] Fri, 19 November 2004 11:57 Go to previous messageGo to next message
Christian Elsen is currently offline Christian ElsenFriend
Messages: 33
Registered: July 2009
Member
Hi Pierce,

have you checked your imports? Could be that your're trying to e.g. add a
awt-FocusListener to an swt-button or vice versa.

Best Regards,
Christian Elsen
www.zeos-informatics.com

> I have a dialog that implements the focuslistener interface, and I cannot
> add a focuslistener to a button in the dialog. The error I get says
> "The method AddFocusListener(FocusListener) in the type Control is not
> applicable for the arguments(NewPatientDialog).

> The code is pretty straightforward:
> public class NewPatientDialog extends Dialog implements SelectionListener,
> FocusListener {

> ...
> m_clearFields = new Button(btnComposite, SWT.PUSH);
> m_saveDefaults = new Button(btnComposite, SWT.PUSH);
> m_clearFields.setText(NLSStrings.getString("clearFieldsBtnLabel "));

> m_saveDefaults.setText(NLSStrings.getString("saveDefaultsBtnLabel "));
> m_clearFields.addSelectionListener(this);
> m_clearFields.addFocusListener(this); // unhappy here
> m_saveDefaults.addSelectionListener(this);
> m_saveDefaults.addFocusListener(this); // unhappy here as well

> ...
> }

> Any thoughts?

> --PK
Re: focuslistener and buttons don't mix? [message #446182 is a reply to message #446179] Fri, 19 November 2004 14:26 Go to previous message
Pierce is currently offline PierceFriend
Messages: 42
Registered: July 2009
Member
Christian Elsen wrote:

> Hi Pierce,

> have you checked your imports? Could be that your're trying to e.g. add a
> awt-FocusListener to an swt-button or vice versa.

That was it -- I was implementing the awt focuslistener by mistake.
Thanks Christian.

--PK
Previous Topic:How to print Drawable object .for eample Table
Next Topic:keeping buttons off of tab groups?
Goto Forum:
  


Current Time: Fri Oct 23 12:08:58 GMT 2020

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

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

Back to the top