News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

How to add new page to the editor (something like wxSmith does)?

Started by polygon7, August 12, 2006, 06:06:51 PM

Previous topic - Next topic

polygon7

Hi,
I'm trying to add simple blank wxFlatNotebook page to the Editor (something like wxSmith does), but with this code:
Code (cpp) Select

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

mandrav

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...

polygon7

best regards,
p7
Free open source UML modeling tool: ArgoUML