[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: focuslistener and buttons don't mix?

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