I have written a piece of code that opens a txt file, reads in the dataset inside it and saves it in a sqlite3 db.
The entries of the database are also shown in a wxListCtrl.
Later on, after the user has added more datasets to the textfile, I want him to be able to open it again with my programme, which should recognise the new entries and add them to the existing database. <- I already got that all more or less working.
However, the problem is that after I have added the new entries to the listctrl, they are: a) not shown, till I explicitly redraw the window and b) I always get the error:
"Couldn't retrive information about entry x in listbox" for every new element that the programme has found in the txt file. (so lets say it found four new entries, I get four errors for them.)
I followed my function in the debugger up until the point where it goes into the wxApp and other internals - without the error flagging up - I also tried deleting all elements in the listctrl and then inserting them again into the listctrl, but i still get the same error.
I don't know if it helps to find the problem but I still added the piece of code:
Code: Select all
bool X::update_db(wxListCtrl* _listbox){
wxListCtrl* org_listbox = _listbox;
if(org_listbox->GetItemCount()<list.size()-1)
{
for(int x=0;x<list.size()-1;x++)
{
if(org_listbox->GetItemText(x,0)!=list[x])
{
wxString maskA = "<p align=\"center\"><font face=\"Segoe UI\"size=\" size=\"style=\" color=\"#000000\" >";
maskA.append(list[x]);
maskA.append("</font>");
wxString maskB = "<!empty>";
wxString tmp_query = // some sql query
parent->current_db.query(tmp_query.wc_str());
}
}
org_listbox->DeleteAllItems();
parent->edit_entry->fill_columns();
}
}
Any ideas how to get rid of those mistakes ? should i post more src code ?