[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [platform-swt-dev] Background & foreground colors of a Button widget
- From: David Whiteman <dlwhiteman@xxxxxxxxxxxxxxx>
- Date: Tue, 27 Jul 2004 14:11:11 -0400
- Delivered-to: email@example.com
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.
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
* implement an owner draw button via windows callbacks
* get a GC on the button and update the color every time you get a
* implement an emulated button widget (e.g. CButton instead of CLabel)