Page 1 of 1

wxBook Projekt

Posted: Wed Aug 31, 2005 3:35 pm
by AllektoSoftware
Hi everyvody,

does anybody have experience with the new book about wxWidgets? I've just bought it recently and worked through the first 70 pages.

Looks pretty interesting and it seems to be a good help for a wxWidgets developer.

Somehow there are quite a few errors, like this one for example. This code within the book should demonstrate the wxNotebook:

Code: Select all

    wxNotebook *notebook = new wxNotebook(this, wxID_ANY,                          wxDefaultPosition, wxDefaultSize);
	
	wxImageList *imageList = new wxImageList(16,16,true, 3);
	imageList->Add(wxIcon(copy_xpm));
	imageList->Add(wxIcon(paste_xpm));
	imageList->Add(wxIcon(cut_xpm));
	
	wxPanel1 *window1 = new wxPanel(notebook, wxID_ANY);
	wxPanel2 *window2 = new wxPanel(notebook, wxID_ANY);
	wxPanel3 *window3 = new wxPanel(notebook, wxID_ANY);
	
	notebook->AddPage(window1, wxT("Tab One"), true,0);
	notebook->AddPage(window2, wxT("Tab two"), false,1);
	notebook->AddPage(window3, wxT("Tab three"), false,2);

First of all this code cannot be compiled because there are no wxPanel1 2 and 3. It should read like wxPanel *Panel1 ...

After correcting the code, the application compiles, but just crashes, because they try to give the tabs images, when there is no connection to an wxImageList defined.

This line is missing:

Code: Select all

	notebook->SetImageList(imageList);
That's pretty annoying, especially for newbies that i guess are wondering why the examples do not work.

I hope that there aren't many mistakes like this later on, in the more complicated examples. But anyhow i guess it's a must have for a wxWidgets developer.

Cheers,

Gunnar

Posted: Wed Aug 31, 2005 4:15 pm
by KevinHock
This is definitely incorrect, thanks for spotting it, an apologies. We certainly would appreciate hearing any "bugs" in the book because they can be corrected for subsequent reprints, and we can also add a note to the book page under Errata.

The example in question is on page 73.

Posted: Wed Aug 31, 2005 5:02 pm
by Julian
Yes indeed, apologies, and please point out any other problems so we can update the book in future reprints. I'll add corrections to the Errata section of the wxBook page at:

http://www.wxwidgets.org/book/

We did spend ages proof-reading but after a point it's hard to see the wood for the trees...

Thanks!

Julian

Posted: Wed Aug 31, 2005 6:07 pm
by Chr
okay, there is another error (error? better: something which can be correct for reprints)
On page 63 and p.64 are shown two times the same pictures (the MDI-Demo, and NOT the wxMiniframe)