2

I have

  • A SWT Composite containing other Controls, such as Labels, Buttons, and other custom painted controls. All of this in a generic fashion.

I want

  • To add SWT.MouseEnter and SWT.MouseExit listeners on the main composite, without the children picking up these events.

I don't want

I tried

  • Recursive listeners on children. I hope for a better answer than this one; some sort of SWT configuration on the parent composite, perhaps?
Community
  • 1
  • 1
Georgian
  • 8,795
  • 8
  • 46
  • 87
  • You've got all the options I can think of in your "I don't want" section. Why do you not want to use a display filter? – Baz Nov 10 '15 at 16:21
  • @Baz It just feels... unsafe... and maybe a bit "dirty". Should I just add a filter and check for the main comp's bounds? – Georgian Nov 10 '15 at 16:23
  • It all depends on the options you've got. I personally find it cleaner than adding a listener recursively. You could either check the bounds or get the widget from the listener and check if your composite is its ancestor. But I'm curious if someone comes up with a better solution. – Baz Nov 10 '15 at 16:30
  • I use addFilter with the check for the widget having the composite as an ancestor in similar code for SWT.Gesture. – greg-449 Nov 10 '15 at 19:01

0 Answers0