I'm currently working on a C++ wxWidgets
-based software designed to show some data extracted from .txt
files. Since I want to create multiple tabs, I decided to use wxAuinotebook
with wxListCtrl
.
To create a new tab in wxAuiNotebook
, I need an object and I want this object to be a wxListCtrl
. My goal at the moment is: every time I load a file, the software extracts some data and creates a new tab in the wxAuinotebook
. And to do that, I create a new object in a dynamic array (vector) to have a new ListCtrl
object as a base for the new tab every time.
Here are the interesting parts of my code:
std::vector<wxListCtrl> *Listes;
int nbr_listes = 0; // with a variable to store how many ListCtrl I create
I declare a vector to contain every ListCtrl
objects. And, after the file loading, I create a new ListCtrl
object in the vector:
Listes->push_back((new wxListCtrl(AuiNotebook1, ID_LISTCTRL1, wxPoint(121,48),
wxDefaultSize,
wxLC_LIST|wxTAB_TRAVERSAL|wxVSCROLL,
wxDefaultValidator, _T("ID_LISTCTRL1"))));
// And I want to add a page to the auiNotebook
if (!AuiNotebook1->AddPage(&Listes->at(nbr_listes),
OpenDialog->GetFilename(),
true,
wxNullBitmap)) //ajout d'une page passée en focus
{
cout << "Echec de l'ajout de page! \n";
}
But the compiler returns an error in listCtrl.h
:
\include\wx\msw\listctrl.h|446|error: 'wxListCtrl::wxListCtrl(const wxListCtrl&)' is private
How can I properly add a page to the auiNotebook
with a ListCtrl
inside? I tried some different ways like declaring the vector as a vector of pointers, but that failed, too.
Thank you for reading.