I would like to forward all events from one widget to another in SWT. Is it possible to do this?
For the record:
I have a checkbox widget set against a dark background. On Windows, it is impossible to actually set the color for a button label, Windows uses black, making my checkbox illegible. Hence my solution was to create a checkbox with no label, and put a standard SWT label next to it. This works great until I try to click on the label. The expected behavior is that a click/hover on the label is the same as a click/hover on the checkbox.
I’d recommend you to add a
paintListenerto your checkbox and on itspaintControlmethod redraw the text with the color you want on the same position of the original text.This way you won’t have an extra widget to deal with.
EDIT:
As you said the
PaintListeneris not an option, then I’d suggest you to add to the label listeners to all events you want to forward to the checkbox.On the checkbox, add the same listeners (not the same instances, the same types).
Finally, on the listeners added to the label, just do