Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Non Rectangular Custom Widget - Focus Problem

Do SWT widgets have anything similar to AWT Component's contains() method
for detecting mouse click events?

I have developed a non-rectangular (Rounded Corner) button using the draw2d
Clickable class. I detect mouse events in the button using the contains()
method of the draw2d Clickable object.  I have placed the Clickable object
on a SWT Canvas using an instance of LightWeightSystem.

As the button is non-rectangular, when I click outside the button (but on
the containing canvas), the canvas detects the mouse event and gives focus
to the button (causing it to draw focus). Is there a way to change the
behavior of the Canvas, so it only gets focus when clicked in a specific
area, and not the entire canvas area.

Also, is there an implementation of a custom RoundedCornerButton widget in
SWT that I might be able to use?

Thanks!




Back to the top