Skip to main content

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


Only Shells can be non-rectangular (see setRegion).  Even if you use Draw2d figures, the Canvas must still be rectangular.
The best you can do is to match the parent and child's background colors to give the illusion of some other shape.

Please use the SWT newsgroup for questions about the usage of SWT.

-Randy



"Mansoor Mirza" <mmirza@xxxxxxxxxxxxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx

09/20/2004 08:35 PM
Please respond to platform-swt-dev

       
        To:        <platform-swt-dev@xxxxxxxxxxx>
        cc:        
        Subject:        [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!


_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top