Errata for Cross-Platform GUI Programming with wxWidgets

Errors will be corrected in future reprints. Please report errors to Julian Smart at julian@anthemion.co.uk.

Error on P. xii

At the top of the page, the page reference "31" should read "131".

Error on P. 52

In the text: "SetOwnForegroundColour is the same as SetOwnForegroundColour but the color is not inherited by the window's child", the second SetOwnForegroundColour should be "SetForegroundColour".

Error on P. 63

Figure 4-5 repeats the MDI screenshot from Figure 4-6, and should instead show the following picture.

Error on P. 72

In the example code for the wxPanel, this code:

wxPanel* panel = new wxPanel(frame, wxID_ANY,
  wxDefaultPosition, (500,300));

should read:

    wxPanel* panel = new wxPanel(frame, wxID_ANY,
        wxDefaultPosition, wxSize(500,300));
Error on P. 73

This example:

    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);

should instead read:

    wxImageList *imageList = new wxImageList(16,16,true, 3);
    imageList->Add(wxIcon(copy_xpm));
    imageList->Add(wxIcon(cut_xpm));
    imageList->Add(wxIcon(paste_xpm));
    notebook->SetImageList(imageList);
       
    wxPanel *window1 = new wxPanel(notebook, wxID_ANY);
    wxPanel *window2 = new wxPanel(notebook, wxID_ANY);
    wxPanel *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);

(remove numbering from wxPanel1, wxPanel2, and wxPanel3, add a SetImageList call, switch the ordering of the paste_xpm and cut_xpm lines to match the ordering of the tab icons in Figure 4-9, and add a comma between "false" and "2" on the last line.)

Error on P. 77

In the first example, the lines

    int pixelsPerUnixX = 10;
    int pixelsPerUnixY = 10;

should read:

    int pixelsPerUnitX = 10;
    int pixelsPerUnitY = 10;

(change Unix to Unit).

Error on P. 101

Just after the radio button code example, the reference should be to Figure 4-21 and not 4-22 (which is a scrollbar).

Error on P. 128 Reported 2006-04-04

In the code example, second line from the bottom, the symbol SetFieldWidths should be replaced by SetStatusWidths.

Error on P. 136

In the code example, last line before the right brace, "DrawRectangle(rectToDraw);" should read "dc.DrawRectangle(rectToDraw);".

Error on P. 141 Reported 2005-12-09

In the last line of the second example, the variable has the wrong type, so wxString should be changed to wxColour, i.e.:

wxColour color = wxTheColourDatabase->Find(name);

Also, it is not clear that wxTheColourDatabase is an instance of wxColourDatabase, so the text above the example: "You can also use the wxTheColourDatabase pointer" should be replaced with "You can also use the wxTheColourDatabase pointer to an instance of the wxColourDatabase class" where wxColourDatabase is formatted the same way as wxTheColourDatabase.

Error on P. 151

In DrawRotatedText, "dc.SetTextForeground(wxBLACK);" should read "dc.SetTextForeground(*wxBLACK);" (insert a missing asterisk).

Error on P. 153 Reported 2006-05-04

In the example, the line:

dc.SetBrush(*wxBLACK);

should be:

dc.SetBrush(*wxBLACK_BRUSH);

Also, the line:

dc.SetBrush(*wxWHITE);

should be:

dc.SetBrush(*wxWHITE_BRUSH);

Error on P. 154 Reported 2006-03-13

The second line from the bottom, the line

  pt.x = i*10; pt.y = i*20;

should read:

  points[i].x = i*10; points[i].y = i*20;

Error on P. 155 Reported 2006-04-27

On line 8, "DrawPolygonPolygon" should read "DrawPolyPolygon".

Error on P. 156

In the comment: "3-point sline" should read "3-point spline".

Error on P. 172

In the first entry of Table 6-1, the first two letters (EV) should be in the same font as the rest of the word. There is also a missing ")" after "EVT_LEFT_DOWN(func".

Error on P. 179

The text "ASCII "A" (65) and ASCII A (97)" should read "ASCII "A" (65) and ASCII "a" (97)".

Error on P. 183 Reported 2005-12-13

In Table 6-5, the event table names in the first and second rows are incorrect, missing a final _DOWN and _UP. The macros should be EVT_JOY_BUTTON_DOWN(func) and EVT_JOY_BUTTON_UP(func).

Error on P. 201 Reported 2005-12-13

Near the end of the code example, a 3 should be changed to a 1. So the following code:

gridBagSizer->AddGrowableRow(3);
gridBagSizer->AddGrowableCol(2);

should be corrected to read:

gridBagSizer->AddGrowableRow(1);
gridBagSizer->AddGrowableCol(2);

Error on P. 205 Reported 2005-12-13

"We will divide the dialogs into the categories Informative Dialogs, File and Directory Dialogs, Choice and Selection Dialogs, and Entry Dialogs."

should be corrected as follows:

"We will divide the dialogs into the categories Informative Dialogs, File and Directory Dialogs, Choice and Selection Dialogs, Entry Dialogs, and Printing Dialogs."

Error on P. 227 Reported 2005-12-23

"Then call ShowDialog" in the third paragraph should be corrected to say:

"Then call ShowModal"

Error on P. 247

Replace "ID_SAGE" with "ID_AGE" in two instances of "FindWindow(ID_SAGE)".

Error on P. 248

In the following text on the second half of the page:

We need to dig a bit deeper into how wxWidgets handles
validators in order to understand what's going on here. As we've
seen, the default OnOK handler calls TransferDataToWindow, but
before it does so, it calls Validate, vetoing the calls to
TransferDataToWindow

replace both references to "TransferDataToWindow" with "TransferDataFromWindow".

Error on P. 272 Reported 2005-12-23

In the second line of the sample, insert a space after the asterisk to match the style of other declarations. The line becomes:

wxFileSytem* fileSystem = new wxFileSystem;

Error on P. 273

On the fifth line in the code example, this line:

// Method 2: load from an ICO resource (Window and OS/2 only)
should be:
// Method 2: load from an ICO resource (Windows and OS/2 only)
(replace "Window" with "Windows").

Error on P. 282 Reported 2005-12-23

For clarity, replace this text:

Note that it will append _xpm to the file name that you specify.

with this text:

Note that the C variable name in the XPM image becomes the concatenation of the file name and "_xpm". 
In the above code, the variable name becomes myimage_xpm.
Error on P. 284

Rotate takes several arguments, not just one, so in the example, replace the line

wxImage image2 = image1.Rotate(0.5);
with:

wxImage image2 = image1.Rotate(0.5, wxPoint(100, 100));

Error on P. 398

In the example 7 lines from the bottom, "fileMsg.Read" should be "file.Read".

Error on P. 537

In the first paragraph, "16x6" should read "16x16".

Error on P. 539

On the second line, "use wxID_HELP, wxID_PREFERENCES, and wxID_HELP" should read use "wxID_ABOUT, wxID_PREFERENCES, and wxID_EXIT".

Error on P. 680, 681

References to MDI should also point to page 63 as well as page 413.

Error on P. 683 Reported 2006-01-31

Reference to popup menus points to P. 358, wxTaskBarIcon events. It should also refer to P. 116 about how to create popup menus.

Error on P. 694

wxGrid is referenced as 345-346. It should be 346-347.