Posted April 19, 2023
I'm using wxWidgets, and I'm trying to make a frame with a notebook in it, and when I add a tab to the notebook, it should fill that tab with another specific kind of frame (MyFrame), which has a toolbar along the top and the rest under that is a splitter window. What goes in the toolbar and splitter window is irrelevant at the moment.
The problem that I'm having is that when I try to create the new tab, first of all, it's showing the toolbar correctly (though it's empty, just because I haven't added anything to it), but it doesn't seem to be showing the splitter window correctly, because there's no vertical line for me to move left and right, to change where the two sides of the window appear.
The other weird problem that I'm having is that it's opening the MyFrame in a new popup window rather than displaying it in the tab. The tab gets created properly (I didn't include that code, because it's a whole other can of worms, but it's working correctly), but it stays empty, while the new popup window displays.
Here's the definition of MyFrame:
class MyFrame : public wxFrame
{
public:
MyFrame(wxWindow* parent, const wxString& title);
wxToolBar* toolbar;
};
Here's the constructor for it:
MyFrame::MyFrame(wxWindow* parent, const wxString& title) : wxFrame(parent, wxID_ANY, title)
{
wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
toolbar = new wxToolBar(this, wxID_ANY);
toolbar->Realize();
vbox->Add(toolbar, 0, wxEXPAND);
wxSplitterWindow* splitterWindow = new wxSplitterWindow(this, wxID_ANY);
splitterWindow->SplitVertically(new wxWindow(splitterWindow, wxID_ANY), new wxWindow(splitterWindow, wxID_ANY));
vbox->Add(splitterWindow, 0, wxEXPAND);
SetSizer(vbox);
}
Here's the part that is trying to create the new frame and put it into the notebook:
MyFrame* myFrame = new MyFrame(myNotebook, myTabName);
myNotebook->AddPage(myFrame, myTabName);
So what could be wrong with this? Thanks if you can help me.
The problem that I'm having is that when I try to create the new tab, first of all, it's showing the toolbar correctly (though it's empty, just because I haven't added anything to it), but it doesn't seem to be showing the splitter window correctly, because there's no vertical line for me to move left and right, to change where the two sides of the window appear.
The other weird problem that I'm having is that it's opening the MyFrame in a new popup window rather than displaying it in the tab. The tab gets created properly (I didn't include that code, because it's a whole other can of worms, but it's working correctly), but it stays empty, while the new popup window displays.
Here's the definition of MyFrame:
class MyFrame : public wxFrame
{
public:
MyFrame(wxWindow* parent, const wxString& title);
wxToolBar* toolbar;
};
Here's the constructor for it:
MyFrame::MyFrame(wxWindow* parent, const wxString& title) : wxFrame(parent, wxID_ANY, title)
{
wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
toolbar = new wxToolBar(this, wxID_ANY);
toolbar->Realize();
vbox->Add(toolbar, 0, wxEXPAND);
wxSplitterWindow* splitterWindow = new wxSplitterWindow(this, wxID_ANY);
splitterWindow->SplitVertically(new wxWindow(splitterWindow, wxID_ANY), new wxWindow(splitterWindow, wxID_ANY));
vbox->Add(splitterWindow, 0, wxEXPAND);
SetSizer(vbox);
}
Here's the part that is trying to create the new frame and put it into the notebook:
MyFrame* myFrame = new MyFrame(myNotebook, myTabName);
myNotebook->AddPage(myFrame, myTabName);
So what could be wrong with this? Thanks if you can help me.
Post edited April 19, 2023 by HeresMyAccount
No posts in this topic were marked as the solution yet. If you can help, add your reply