I created a new wxSmith app, and manually changed the main form declaration from:
class TestMDIFrame: public wxFrame
to
class TestMDIFrame: public wxMDIParentFrame
From the wxSmith menu, I selected Add wxFrame and changed the base class to wxMDIChildFrame.
This gave me a header with declaration like this:
class BaseChildFrame: public wxMDIChildFrame
{
public:
BaseChildFrame(wxWindow* parent,wxWindowID id=wxID_ANY,const wxPoint& pos=wxDefaultPosition,const wxSize& size=wxDefaultSize);
Note that the parent is incorrectly declared as wxWindow*, but that was easy to change to wxMDIParentFrame*.
I ultimately rewrote the entire constructor to conform to the wxWidgets documentation for class wxMDIChildFrame:
class BaseChildFrame: public wxMDIChildFrame
{
public:
BaseChildFrame(wxMDIParentFrame* parent,
wxWindowID id=wxID_ANY,
const wxString& title=wxEmptyString,
const wxPoint& pos=wxDefaultPosition,
const wxSize& size=wxDefaultSize,
long style=wxDEFAULT_FRAME_STYLE,
const wxString &name=wxFrameNameStr);
And here is the implementation of the constructor:
BaseChildFrame::BaseChildFrame(wxMDIParentFrame* parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
{
Create(parent, id, title, pos, size, style, name);
//(*Initialize(BaseChildFrame)
//Create(parent, id, _("BaseChildFrame"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("id"));
SetClientSize(wxDefaultSize);
Move(wxDefaultPosition);
Connect(wxID_ANY,wxEVT_CLOSE_WINDOW,(wxObjectEventFunction)&BaseChildFrame::OnClose);
//*)
}
Then I created a menu item on the wxMDIParentFrame that creates and shows instances of the BaseChildFrame:
void TestMDIFrame::OnFileNewChildItemSelected(wxCommandEvent& event)
{
BaseChildFrame* t_child = new BaseChildFrame(this, wxID_ANY, _T("New child window"));
if (t_child)
{
t_child->Show();
}
}
When I build this for Linux, the child frames display in tabbed pages (as expected).
But when I build this for Windows, the main menu adds a Window item, and the new BaseChildFrame is listed there, but the child window does not show.
I hope that is enough information for somebody to figure out what I have implemented incorrectly.
Thanks for your help.
Kathleen