wxWidgets / wxWidgets

Cross-Platform C++ GUI Library
https://www.wxwidgets.org/
6.04k stars 1.76k forks source link

Changing status bar foreground not supported in wxMSW #13207

Open wxtrac opened 13 years ago

wxtrac commented 13 years ago

Issue migrated from trac ticket # 13207

component: wxMSW | priority: low | keywords: wxStatusBar,SetForegroundColour()

2011-05-10 00:32:06: wxtester (wxtester) created the issue


SetForegroundColour() has no effect in the sample application. Even if using "Own" there is no effect. Both strings "Test1" and "Test2" appear still black. See attached screenshot or the sample application.

Sample Win32 Application: [http://rapidshare.com/files/461625217/Test.zip]

#include "wx/wx.h"

class Frame : public wxFrame{
public:
    Frame::Frame() 
        :wxFrame((wxWindow *)NULL,-1,"foo",wxDefaultPosition,wxSize(320,200))
    {   
        wxStatusBar *sb = CreateStatusBar(2);
        bool test1 = sb->SetForegroundColour(*wxRED);
        sb->SetOwnForegroundColour(*wxGREEN);   
        sb->SetStatusText("Test1",0);
        sb->SetStatusText("Test2",1);
    }
};

class App : public wxApp{
public: 
    virtual bool App::OnInit(){
        Frame *pFrame = new Frame();
        pFrame->Show(TRUE);
        SetTopWindow(pFrame);
        return TRUE;
    }
};

DECLARE_APP(App)
IMPLEMENT_APP(App)

Maybe i am doing something wrong?

wxtrac commented 13 years ago

2011-05-10 00:32:22: wxtester (wxtester) uploaded file test.cpp (0.6 KiB)

source code

wxtrac commented 13 years ago

2011-05-10 00:32:56: wxtester (wxtester) uploaded file statusbar.png (5.5 KiB)

Screenshot statusbar.png

wxtrac commented 13 years ago

2011-07-23 22:38:55: @vadz changed priority from normal to low

2011-07-23 22:38:55: @vadz changed status from new to confirmed

2011-07-23 22:38:55: @vadz changed title from wxStatusbar SetForegroundColour does not work to Changing status bar foreground not supported in wxMSW

2011-07-23 22:38:55: @vadz commented

Changing foreground colour doesn't seem to be directly supported by the native status bar. Background colour can be changed using SB_SETBKCOLOR (which we don't currently use neither but it would be simple to add) but apparently the only way to have a non default foreground colour is to use a custom status bar pane (see statbar sample for examples of doing this).

We probably could make all panes owner-drawn if the foreground colour was changed to non default one but it would be a lot of work for not much gain, so while I'd apply any [HowToSubmitPatches patches] adding support for this I don't plan to do it myself.