#4 wrong color values used for window creation

closed
nobody
None
5
2005-08-02
2005-07-16
Anonymous
No

In file WindgetWindow.h in function createWindow the
wrong colors are assigned. The standard system colors
are assigned but MS Windows SDK help says that he value
1 must be added to the chosen color.

template<class Parent, class WidgetMessageMapType>
void WidgetWindow<Parent,
WidgetMessageMapType>::createWindow( const
CreationalStruct & cs, bool isChild )

...
if( isChild )
wc.hbrBackground = (HBRUSH)( COLOR_BTNTEXT );
else
wc.hbrBackground = (HBRUSH)( COLOR_APPWORKSPACE );
...

should be

if( isChild )
wc.hbrBackground = (HBRUSH)( COLOR_BTNTEXT +1);
else
wc.hbrBackground = (HBRUSH)( COLOR_APPWORKSPACE +1 );

MS Windows SDK help text
hbrBackground
Identifies the class background brush. This member can
be a handle to the physical brush to be used for
painting the background, or it can be a color value. A
color value must be one of the following standard
system colors (the value 1 must be added to the chosen
color). If a color value is given, you must convert it
to one of the following HBRUSH types:

COLOR_ACTIVEBORDER
COLOR_ACTIVECAPTION
COLOR_APPWORKSPACE
...

Discussion

  • Thomas Hansen
    Thomas Hansen
    2005-08-02

    • status: open --> closed