Changing background color of a frame wxwidgets

hi guys I tried to set a background color of a frame in wxWidgets but to no avail,I get no errors or anything but when I try to change it it still remains the default grey,I created another frame to compare it to

anyway the strange thing is when I add a panel to the frame the color changes but how is this possible when I didn't even set the panels background color?

thanks

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

bool yguyguyApp::OnInit()
{

    wxFrame *frame = new wxFrame((wxFrame*) NULL, -1, _T("Hello wxWidgets World"));
	frame->CreateStatusBar();
	frame->SetStatusText(_T("Hello World"));
	frame->Show(true);
	SetTopWindow(frame);
	std::cout << "hello wibuhdu" << std::endl;

	wxFrame *frame2 = new wxFrame((wxFrame*) NULL, -1, _T("Hello hyguygigybdgets World"));
	frame2->CreateStatusBar();
	frame2->SetStatusText(_T("Hello World"));
	unsigned char a = 0;
	unsigned char b = 170;
	unsigned char c = 0;
	unsigned char d = 120;


	wxColour* colour = new wxColour(a,b,c,d); // use either one
	wxColour colour2(a,b,c,d);

	frame2->Show(true);
	frame2->SetBackgroundColour(colour2);  // DOES NOT CHANGE
	SetTopWindow(frame2);
       // wxPanel * panel = new wxPanel(frame2, wxID_ANY, wxDefaultPosition, 
        wxSize(300, 300)); WHEN I UNCOMMENT THIS IT CHANGES



	return true;

}
It sounds backwards. For me the frame show up as green but if I add the panel it covers the background so that it appears grey.
Last edited on
that's strange :o,it's the other way around for me
Last edited on
ahh ok I know whats going on I set the backGround color to green after I set show frame to true
Last edited on
Topic archived. No new replies allowed.