[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Background & foreground colors of a Button widget

Tuesday, July 27, 2004, 1:47:20 PM, Qian Qiao wrote:

> Hi all,

> I am currently working on a project that uses SWT and JFace.

> Currently my code generates a set of buttons. And I decided to color
> these buttons.

> The SWT api suggests the Button inherit setBackground(Color) and
> setForeground(Color) from Control, however, invoking these methods has
> no effect on the look of the button.

> Any suggestions or alternatives?

> Thanks in advance.

> --Joe

I assume you are running this on win32.  This is a known limitation of
the native Windows control that button colors can't be changed.  If
you really want the button to change colors, you could do one of the
following:

* implement an owner draw button via windows callbacks
* get a GC on the button and update the color every time you get a
paint message
* implement an emulated button widget (e.g. CButton instead of CLabel)

-- 
Regards,
David                            
mailto:dlwhiteman@xxxxxxxxxxxxxxx
news://news.eclipse.org/eclipse.platform.swt
http://www.eclipse.org/newsportal/thread.php?group=eclipse.platform.swt