Author Topic: How to add new page to the editor (something like wxSmith does)?  (Read 4840 times)

Offline polygon7

  • Multiple posting newcomer
  • *
  • Posts: 104
    • Home site
Hi,
I'm trying to add simple blank wxFlatNotebook page to the Editor (something like wxSmith does), but with this code:
Code: cpp
class PluginTest : public cbPlugin
{
(...)
 private:
        DECLARE_EVENT_TABLE();
        void OnMenuClick(wxCommandEvent& event);
        wxFlatNotebook* m_Notebook;
        wxPanel* m_Panel;
};
//-------------------------------------------------------------------------------------------
static int NewPanelId = wxNewId();

void PluginTest::OnMenuClick(wxCommandEvent& event)
{
    Manager::Get()->GetMessageManager()->Log(_("\nPluginTest::OnMenuClick() clicked.\n"));
    m_Notebook = Manager::Get()->GetEditorManager()->GetNotebook();
    //wxFlatNotebook* Notebook = Manager::Get()->GetProjectManager()->GetNotebook();
    if (m_Notebook)
    {
        Manager::Get()->GetMessageManager()->Log(_("\nManager::Get()->GetProjectManager()->GetNotebook() == TRUE\n"));
        m_Panel = new wxPanel(m_Notebook, NewPanelId, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER);
        m_Notebook->AddPage(m_Panel, _("Testing, testing..."));
    }
}
I have alot of "crash" messageboxes (endless-loop?) when I click on newly created page. :(
Could somebody tell me (in simple words please :P, I'm wxWidgets newbie) what is wrong with my code?
best regards,
p7
 Free open source UML modeling tool: ArgoUML

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: How to add new page to the editor (something like wxSmith does)?
« Reply #1 on: August 12, 2006, 06:47:11 pm »
In order to add a new page in the editors' notebook, your page must derive from EditorBase (not from wxPanel).
When you create your EditorBase-derived page, it is automatically added to the notebook...
Be patient!
This bug will be fixed soon...

Offline polygon7

  • Multiple posting newcomer
  • *
  • Posts: 104
    • Home site
Re: How to add new page to the editor (something like wxSmith does)?
« Reply #2 on: August 12, 2006, 09:04:59 pm »
Thank you, it works :)
best regards,
p7
 Free open source UML modeling tool: ArgoUML