Search code examples
buttonfocusswteclipse-rap

Eclipse Rap no focus on a button


I have a problem with Focusable Buttons on Eclipse Rap. I have defined some Toogle buttons with some css style when your mouse is over it, with it is selected and when it is not. The thing is the focus on the button is making it look odd.

I have tried

btnAnimals = new Button(panel, SWT.TOGGLE | SWT.NO_FOCUS);

with no exit. And finally I decided to implement a FocusAdapter for the buttons:

FocusListener focusListener = new FocusAdapter() {
        @Override
        public void focusGained(FocusEvent event) {
            txtStreet.setFocus();
        }
    };
    btnAnimals.addFocusListener(focusListener);

The strange issue that this listener is only called ONCE. Do you know what I am doing wrong? Is it a bug?

Thanks in advance


Solution

  • After asking in Eclipse Rap Forum, they give me the propper answer and it is to use RWT Theming:

    Button-FocusIndicator {
       border: none;
    }
    

    Hope that helps ;)