Background of wxNotebook

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
eriX
Experienced Solver
Experienced Solver
Posts: 84
Joined: Wed Feb 04, 2009 2:08 pm
Location: Germany
Contact:

Background of wxNotebook

Post by eriX » Mon Dec 05, 2011 6:32 pm

Hello...

I can't find any way out of this problem.
I want to have a black background in wxNotebook like my background is, but the colors I set become always ignored...

tried it with: background-color, foreground-color, General > wxTransparentWindow... nothin works.

I attached a screenshot:
falsebg.png
Hope you have a solution for my problem.

Thanks!

jgrzybowski
Earned some good credits
Earned some good credits
Posts: 113
Joined: Sat Sep 24, 2011 9:32 pm
Location: Poland

Re: Background of wxNotebook

Post by jgrzybowski » Tue Dec 06, 2011 11:59 pm

I have already tried and wxDevC++ (WinXP) has generated following code:

Code: Select all

WxNotebook1 = new wxNotebook(WxPanel1, ID_WXNOTEBOOK1, wxPoint(12, 13), wxSize(533, 292), wxNB_DEFAULT);
WxNotebook1->SetBackgroundColour(wxColour(wxT("BLACK")));
Try to change background color of all yours wxNotebookPages
Regards
Jarek
Attachments
black.JPG

BarrRobot
Knows some wx things
Knows some wx things
Posts: 32
Joined: Thu Nov 26, 2009 12:50 am
Location: Birmingham, UK

Re: Background of wxNotebook

Post by BarrRobot » Wed Dec 07, 2011 12:05 pm

jgrzybowski wrote:Try to change background color of all yours wxNotebookPages
I cannot get that result. I see the same problem as eriX. I am using build 7.4.0.86 and I completely removed the old versions before I installed, so I am reasonably certain that I am using the version of wxWidgets that was bundled with build 7.4.0.86. Which build are you using?
@eriX: Which build are you using?

This looks to me as if the correct code is being generated by the RAD, but the line to set the background colour is ignored, even if it is used outside the automatically generated code. That makes me think it is a wxWidgets problem, not a wxDev-C++ one. Maybe this question should be posted on the C++ Development Forum?
If, 6 months later, you can't understand what you coded, it was too complicated to begin with.

User avatar
doublemax
Moderator
Moderator
Posts: 14977
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Background of wxNotebook

Post by doublemax » Wed Dec 07, 2011 12:28 pm

You could also try wxAuiNotebook, which - as a non-native control - might be more willing to accept non-standard colors ;)

http://docs.wxwidgets.org/stable/wx_wxa ... uinotebook
Use the source, Luke!

BarrRobot
Knows some wx things
Knows some wx things
Posts: 32
Joined: Thu Nov 26, 2009 12:50 am
Location: Birmingham, UK

Re: Background of wxNotebook

Post by BarrRobot » Wed Dec 07, 2011 1:29 pm

doublemax wrote:You could also try wxAuiNotebook, which - as a non-native control - might be more willing to accept non-standard colors ;)

http://docs.wxwidgets.org/stable/wx_wxa ... uinotebook
Nope, that works the same way for me. I tried passing the colour value in different formats but with no observable change to the result :(
If, 6 months later, you can't understand what you coded, it was too complicated to begin with.

jgrzybowski
Earned some good credits
Earned some good credits
Posts: 113
Joined: Sat Sep 24, 2011 9:32 pm
Location: Poland

Re: Background of wxNotebook

Post by jgrzybowski » Wed Dec 07, 2011 9:29 pm

It was test made in wxDevC++ 7.3.1.3 and wxWidgets 2.8.9
Jarek

BarrRobot
Knows some wx things
Knows some wx things
Posts: 32
Joined: Thu Nov 26, 2009 12:50 am
Location: Birmingham, UK

Re: Background of wxNotebook

Post by BarrRobot » Wed Dec 07, 2011 11:29 pm

jgrzybowski wrote:It was test made in wxDevC++ 7.3.1.3 and wxWidgets 2.8.9
Ah! I see different behaviour between your wxWidgets 2.8.9 and my wxWidgets 2.8.12.
Thank you.
<Edit: My Widgets version was incorrectly shown as 2.9.2>.
Last edited by BarrRobot on Sat Dec 10, 2011 12:02 pm, edited 1 time in total.
If, 6 months later, you can't understand what you coded, it was too complicated to begin with.

eriX
Experienced Solver
Experienced Solver
Posts: 84
Joined: Wed Feb 04, 2009 2:08 pm
Location: Germany
Contact:

Re: Background of wxNotebook

Post by eriX » Thu Dec 08, 2011 3:24 pm

Thanks for your responses!

I'm using wxDevC++ 7.4.0.77 with wxWidgets 2.8.9 on Windows 7 x64.

I've tried wxAuiNotebook and the normal wxNotebook in a new project but it doesn't work again. =/

@BarrRobot: Do you have success with wxWidgets 2.9.2?
Does wxDevC++ 7.4.0.86 come now with wxWidgets 2.9.2 or have you compiled it for yourself?

BarrRobot
Knows some wx things
Knows some wx things
Posts: 32
Joined: Thu Nov 26, 2009 12:50 am
Location: Birmingham, UK

Re: Background of wxNotebook

Post by BarrRobot » Thu Dec 08, 2011 11:11 pm

I have been looking at bugs on the http://trac.wxwidgets.org site.

It appears that there have been problems with inheriting the background colour. So I tried setting the background colour of the wxNotebook and not setting the background colour of the pages.
The pages inherit the background colour of the Notebook, but the Notebook does not show the background colour.
:shock: :shock: :shock:

I am still checking, but this looks very much like a Widgets library bug.
If, 6 months later, you can't understand what you coded, it was too complicated to begin with.

BarrRobot
Knows some wx things
Knows some wx things
Posts: 32
Joined: Thu Nov 26, 2009 12:50 am
Location: Birmingham, UK

Re: Background of wxNotebook

Post by BarrRobot » Thu Dec 08, 2011 11:14 pm

eriX wrote: @BarrRobot: Do you have success with wxWidgets 2.9.2?
No, wxWidgets 2.8.12 <Edit: was incorrectly shown as 2.9.2> shows the same bug that you see.
eriX wrote: Does wxDevC++ 7.4.0.86 come now with wxWidgets 2.9.2 or have you compiled it for yourself?
Yes, the download for wxDevC++ 7.4.0.86 comes with wxWidgets 2.8.12
<Edit: Correction: Widgets version 2.9.2 is NOT presently shipped with wxDev-C++>.
Last edited by BarrRobot on Sat Dec 10, 2011 12:06 pm, edited 1 time in total.
If, 6 months later, you can't understand what you coded, it was too complicated to begin with.

tbreina
Moderator
Moderator
Posts: 1289
Joined: Thu Nov 25, 2004 7:38 pm
Location: Coronado, CA

Re: Background of wxNotebook

Post by tbreina » Fri Dec 09, 2011 3:09 am

7.4 comes with wxWidgets 2.8.12 (however, there's a 2.9.2 download available via the webupdate-- note that I haven't actually tested the 2.9.2 devpak).

I'm able to change the background color, including changing the color each notebook page individually. Is that what you wanted to do?

For example,

Code: Select all

	//Do not add custom code between
	//GUI Items Creation Start and GUI Items Creation End
	//wxDev-C++ designer will remove them.
	//Add the custom code before or after the blocks
	////GUI Items Creation Start

	WxNotebook1 = new wxNotebook(this, ID_WXNOTEBOOK1, wxPoint(59, 57), wxSize(289, 193), wxNB_DEFAULT);
	WxNotebook1->SetBackgroundColour(wxColour(wxT("MAROON")));

	WxNoteBookPage1 = new wxPanel(WxNotebook1, ID_WXNOTEBOOKPAGE1, wxPoint(4, 26), wxSize(281, 163));
	WxNotebook1->AddPage(WxNoteBookPage1, wxT("WxNoteBookPage1"));

	WxNoteBookPage2 = new wxPanel(WxNotebook1, ID_WXNOTEBOOKPAGE2, wxPoint(4, 26), wxSize(281, 163));
	WxNoteBookPage2->SetBackgroundColour(wxColour(wxT("GREEN")));
	WxNotebook1->AddPage(WxNoteBookPage2, wxT("WxNoteBookPage2"));

	WxNoteBookPage3 = new wxPanel(WxNotebook1, ID_WXNOTEBOOKPAGE3, wxPoint(4, 26), wxSize(281, 163));
	WxNotebook1->AddPage(WxNoteBookPage3, wxT("WxNoteBookPage3"));

	SetTitle(wxT("Project1"));
	SetIcon(wxNullIcon);
	SetSize(8,8,476,334);
	Center();

	////GUI Items Creation End
This notebook has 3 pages. I've changed the 2nd page to green. The other pages are the default color (which I've set to maroon). My runtime program shows the correct result and it correlates with what I see in the design window (although the green is a little more lime and the maroon is a little more hideous).

So my guess is that this has something to do with wxWidgets 2.9.2??? This definitely should not be the IDE so long as the code being generated is correct (which it appears to be).

-Tony
Everybody's got something to hide except for me and my monkey.

tbreina
Moderator
Moderator
Posts: 1289
Joined: Thu Nov 25, 2004 7:38 pm
Location: Coronado, CA

Re: Background of wxNotebook

Post by tbreina » Fri Dec 09, 2011 3:16 am

I should also note (since Robert stated that he had "completely removed the old versions before I installed"):

Windows Vista (and 7 I think) has virtual stores that keep some of the wxDev-C++ files even when you've correctly gone through the uninstaller to wipe them out and start "fresh". If you're seeing weird behavior in the IDE despite "upgrading" or "re-installing", you might want to check your AppData\local\VirtualStore\Program Files\Dev-cpp directory for files (and delete them).

In short, due to the VirtualStore files, you may think you are running the latest greatest version, but Windows may actually be running the older version. Another nice "feature" from Microsoft that I've been bitten with all too often.

-Tony
Everybody's got something to hide except for me and my monkey.

eriX
Experienced Solver
Experienced Solver
Posts: 84
Joined: Wed Feb 04, 2009 2:08 pm
Location: Germany
Contact:

Re: Background of wxNotebook

Post by eriX » Fri Dec 09, 2011 5:19 am

7.4.0.86 doenst come with wxwidgets 2.9.2.

I have installed it and I only get errors..
Also a new project does not work, because a library is still missing.
I try to solve in about 10 hours at home.

BarrRobot
Knows some wx things
Knows some wx things
Posts: 32
Joined: Thu Nov 26, 2009 12:50 am
Location: Birmingham, UK

Re: Background of wxNotebook

Post by BarrRobot » Fri Dec 09, 2011 2:44 pm

OK, yes, on closer inspection I was compiling with wxWidgets 2.8 as distributed in the download. I had made my usual mistake of looking at the wrong directory #-o

The problem that I see is the Notebook background can be set, and is inherited by each page, but it does not show in the notebook itself.
I can set a background for each page (not shown). My point here is the Notebook background colour is being read and carried forward into the page, but is not used (or maybe it is used but is immediately overwritten?) in the Notebook itself.

Maybe this is OS-dependent? I am using WinXP SP3.

Here is my code:

Code: Select all

	////GUI Items Creation Start

	WxPanel1 = new wxPanel(this, ID_WXPANEL1, wxPoint(10, 9), wxSize(282, 321));
	WxPanel1->SetBackgroundColour(wxColour(wxT("CYAN")));

	WxNotebook1 = new wxNotebook(WxPanel1, ID_WXNOTEBOOK1, wxPoint(15, 22), wxSize(245, 189), wxNB_DEFAULT);
	WxNotebook1->SetBackgroundColour(wxColour(wxT("BLUE")));

	WxNoteBookPage1 = new wxPanel(WxNotebook1, ID_WXNOTEBOOKPAGE1, wxPoint(4, 24), wxSize(237, 161));
	WxNotebook1->AddPage(WxNoteBookPage1, wxT("WxNoteBookPage1"));

	WxNoteBookPage2 = new wxPanel(WxNotebook1, ID_WXNOTEBOOKPAGE2, wxPoint(4, 24), wxSize(237, 161));
	WxNotebook1->AddPage(WxNoteBookPage2, wxT("WxNoteBookPage2"));

	SetTitle(wxT("Project1"));
	SetIcon(wxNullIcon);
	SetSize(8,8,320,377);
	Center();

	////GUI Items Creation End
and the result:
Notebook_background.png
Notebook_background.png (13.33 KiB) Viewed 6655 times
If, 6 months later, you can't understand what you coded, it was too complicated to begin with.

eriX
Experienced Solver
Experienced Solver
Posts: 84
Joined: Wed Feb 04, 2009 2:08 pm
Location: Germany
Contact:

Re: Background of wxNotebook

Post by eriX » Fri Dec 09, 2011 2:50 pm

That's describes exactly the problem.

I hope somebody has got an idea.

Post Reply