User forums > General (but related to Code::Blocks)

wxNotebook troubles

(1/2) > >>

sethjackson:

--- Code: (cpp) ---m_pNotebook = new wxNotebook(this,
                                 wxID_ANY,
                                 wxDefaultPosition,
                                 wxDefaultSize);

    // Create a new text control using our member pointer.

m_pTextCtrl = new TextCtrl(m_pNotebook,
                               wxID_ANY,
                           wxEmptyString,
                               wxDefaultPosition,
                               wxDefaultSize,
                               wxTE_MULTILINE | wxHSCROLL);

    m_pNotebook->InsertPage(m_pNotebook->GetPageCount(), m_pTextCtrl);

--- End code ---

I get this error.

main.cpp:40: error: no matching function for call to `wxNotebook::InsertPage(size_t, TextCtrl*&)'
C:/wxWidgets-2.6.2/include/wx/msw/notebook.h:136: note: candidates are: virtual bool wxNotebook::InsertPage(size_t, wxNotebookPage*, const wxString&, bool, int)

TextCtrl is my own text control object derived from wxTextCtrl. I wan't to have a tabbed text editor..... How to? Sorry for the dumb question....  :P

thomas:
You must provide a wxString for the title, this is not an optional argument.

http://www.wxwidgets.org/manuals/2.6.2/wx_wxnotebook.html#wxnotebookinsertpage

sethjackson:
Ok. Does TextCtrl parent need to be the notebook or this (this = my main frame)?

EDIT:

when TextCtrl parent is the notebook I get SIGSEV.....  :P What am I doing wrong? I want the inserted page to have a wxTextCtrl. How to do this?

thomas:
I would use this ( = main frame), never sure which is right and which is not, but using the main frame usually works fine with everything :)

sethjackson:
So how do I have my notebook have a tab with a text ctrl?

Navigation

[0] Message Index

[#] Next page

Go to full version