MDI child frame and wxCheckListBox menu problem

Örjan Persson o.persson at gmail.com
Tue May 29 01:28:55 PDT 2007


Hi,

I'm having a problem getting a wxMDIChildFrame derived class' menu to
beeing painted correctly. It seems that some problem occurs when
Windows is trying to draw/measure the menu items due to an invalid
handle.

I can reproduce the problem by adding the last two lines to the
constructor of the mdi sample project like this;

MyChild::MyChild(wxMDIParentFrame *parent, const wxString& title)
       : wxMDIChildFrame(parent, wxID_ANY, title, wxDefaultPosition,
wxDefaultSize,
                         wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
{
    canvas = (MyCanvas *) NULL;
    my_children.Append(this);

    // this should work for MDI frames as well as for normal ones
    SetSizeHints(100, 100);

    // this triggers the measuring and font creation
    wxCheckListBox *checkListBox = new wxCheckListBox(this, -1);
    checkListBox->Append(L"Test");
}

The wxCheckListBox::Append() seem to trigger the .. resulting in these errors;
15:53:49: ..\..\src\msw\dc.cpp(1758): 'GetTextExtentPoint32()' failed
with error 0x00000000 (the operation completed successfully.).
15:53:49: ..\..\src\msw\dc.cpp(1758): 'GetTextExtentPoint32()' failed
with error 0x00000006 (the handle is invalid.).
15:53:49: ..\..\src\msw\dc.cpp(1758): 'GetTextExtentPoint32()' failed
with error 0x00000006 (the handle is invalid.).

If I don't use the wxCheckListbox, the menu seems to work. Anyone has any clues?

Regards,
Örjan




More information about the wx-users mailing list