I have some toggle buttons declared like this :
button = new Button(this, SWT.TOGGLE);
button.setImage(icon);
They look like this on my computer :

The right one is pushed, the left one isn't.
But on some computers, depending on the general settings of the OS, it may be hard to see if the button is pushed.
What can I do to make the button's state more visible, independently of the OS settings ?
I precise the application uses the Eclipse 3 platform and that I need this to work on any Desktop Windows starting from XP.
As I didn't find any clean solution (one which would work for all buttons without having to duplicate all icons), I did as suggested by Alexander :
button.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
button.setImage(button.getSelection() ? pushedIcon : icon);
...
}
});
It looks like this :

On computers with bad color settings (e.g. grey for selection), this will be an improvement.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With