fair enough, here's all the relevant code,
Ok then i will post code, attempt to bear with me,
GUIFrame has a protected variable and an acesscor;
Code:
...
protected:
...
BillList * m_TheList;
...
public:
BillList * getList() { return m_TheList;}
...
we also have
Code:
class BillData
{
public:
wxString Name;
wxString Cost;
wxDateTime DueDate;
BillData(wxString tempName, wxString tempCost, wxDateTime tempDate);
~BillData() {};
};
class BillList
{
private:
std::vector <BillData> theList;
public:
BillData getData(int pos) { if (theList.size()!=0){return theList[pos];};}
wxString getName(int i) {return theList[i].Name;};
wxString getCost(int i) {return theList[i].Cost;};
int getSize() {
if(theList.empty()){
return 0;
}
else {
int temp = theList.size();
return temp;
}
};
void InsertBill(wxString tempName, wxString tempCost, wxDateTime tempTime);
BillList() {};
~BillList(){};
};
When the second dialog opens, the constructor calls...
Code:
...
BillList * tempList;
templist = ((Fincal2Frame*)GetParent())->getList();
int tempE = tempList->getSize();
for(int i = 0; i < tempE; i++){
m_listBox1->Append(tempList->getName(i)+" $"+tempList->getCost(i));
}
...
But when i open the dialog which calls the code show above, i get a segfault that backtraces back to the vector iterators. It doesn't make sense. It doesn't work even if i call it from Fincal2Frame (which inherits GUIFrame!)