wxMSW: Incorrect background on wxButtons?
Robin Dunn
robin at alldunn.com
Thu Apr 19 10:34:57 PDT 2007
Tommy W wrote:
> On Thursday 12 April 2007 22:05, Robin Dunn wrote:
>> Tommy W wrote:
>>> On Wednesday 11 April 2007 23:36, Robin Dunn wrote:
>>>> Are you sure that you used the panel for the parent of the wxButton when
>>>> you created it?
>>> Quite sure actually.
>>>
>>> wxPanel *panel = new wxPanel(this,wxID_ANY);
>>>
>>> panel->SetBackgroundColour(GetBackgroundColour());
>>> panel->SetForegroundColour(GetForegroundColour());
>> Ah, you didn't mention that you were doing this. AFAIK the XP themed
>> button expects to be placed on a themed panel, and the button draws
>> itself accordingly using the theme APIs.
>
> Is there a way around this?
You can set the bg color of the button to be the same as the panel, but
that would probably not be much better. You can use a generic control
instead of the native button. Or you could try removing the manifest
from the app so the old unthemed controls are used.
> I've tried everything it seems like.
> I really think it is strange that you would not be able to place a button over
> a differently colored panel without getting weird results.
Keep in mind that on Windows the button, notebook and other controls are
all separate, mostly independent window objects, with their own
background, foreground and paint event handlers. Add to that the fact
that the new themed controls toss out a lot of the old rules for the old
style solid color controls, and draw themselves with textures,
gradients, or images. So the old concepts of setting a fg or bg color,
or inheriting it from a parent don't mean much anymore, at least for
some widgets.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wx-users
mailing list