Code: Select all
class data
{
public:
wxString returnName() const { return Name;}
int returnCost() const { return cost; }
private:
wxString Name;
int cost;
}
How?
Code: Select all
class data
{
public:
wxString returnName() const { return Name;}
int returnCost() const { return cost; }
private:
wxString Name;
int cost;
}
Short answer, get a book on c++ and read it. Because I'm not a complete dick the longer answer.Terran wrote:and i want to be able to use my add dialog to create a new one, and pass it to a list in the parent frame.
How?
I agree with mc2r that your issue is lack of knowledge in C++. Using wxWidgets is not the same as basic C++, but your issue seems to be dealing about lack of understanding about classes and pointersTerran wrote: Sorry for not understanding how wxWidgets interacts with C++, because unlike what you've stated, using wxWidgets is not the same as basic C++.
Auria wrote:...try writing a little more code than the few lines you posted
Code: Select all
void BillDia::OpenAdd(wxCommandEvent& event)
{
MyDialog1 *addBill = new MyDialog1(this);
addBill->ShowModal();
}
Code: Select all
myFrame : public wxFrame
{
wxList *myList;
}
Code: Select all
myDialog :wxDialog
{
myDiaog();
myDialog(wxWindow* parent, wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size, long style);
//new constructor
myDialog(wxList *list,
wxWindow* parent, wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size, long style);
}
Although that link did (and will) help, it doesn't answer my question completely, i'm trying to figure out how to extract the info from text boxes in the dialog to store them in my data object. I'm not sure how to do it. (i know WHERE; in the event for the "Add" button.)Auria wrote: (Perhaps you should elaborate a little more, it's not always obvious precisely where you're stuck)
try wxTextCtrl::GetValue();i'm trying to figure out how to extract the info from text boxes in the dialog to store them in my data object.
Code: Select all
void BillDia::OpenAdd(wxCommandEvent& event)
{
MyDialog1 *addBill = new MyDialog1(this);
addBill->ShowModal();
mydatastring = addBill->myTextCtrl.GetValue();
}
Code: Select all
if(addBill->ShowModal()==wxID_OK)
{
mydatastring = addBill->myTextCtrl.GetValue();
}
}
This is my point. wxWidgets manges the flow of information from widget to parent using normal c++. If you understand fine how this works than doing the same in wxWidgets should be no problem for you. The fact that you are hung up on there being a difference is further evidence that you should brush up on your c++.Terran wrote:Auria wrote:...try writing a little more code than the few lines you posted
I understand fine how classes and pointers work, i don't undertsand how wxWidgets manages the flow of information from widget to parent.
This is what we are talking about. This is a c++ thing and is where you need to brush up. Forget that it is a dialog or widget or panel or frame or wx*, they are all c++ classes and so c++ rules and convention applies.Terran wrote:So if i call my Add dialog from the dialog that holds the list, how do i pass that info back to the list?
Code: Select all
mydatastring = addBill->myTextCtrl.GetValue();
Don't be sorry, just take the advice(or not, its your call). But that you think it isn't the same as basic c++ is my very point. It is the same. Having solid c++ skills will go a long way to helping you understand wxWidgets as wxWidgets is all C++.Terran wrote:Wow, that really was a dick answer.
Sorry for not understanding how wxWidgets interacts with C++, because unlike what you've stated, using wxWidgets is not the same as basic C++.
Thats not all I did. I told you to get a c++ book, which you may not like but from this post and others you've made you need. I know I know you understand c++ just fine as you keep asserting but your posts suggest otherwise. Don't be offended you are here to learn right? Then work on your c++ it will help you a lot with your wxWidgets.Terran wrote:I know it's not the point, but why would you even bother posting an answer if all you were going to do was beret me for asking a question on a forum designed for asking questions? Yeah you're right, my bad.
There are many steps involved in this; which one causes problems?Terran wrote:Although that link did (and will) help, it doesn't answer my question completely, i'm trying to figure out how to extract the info from text boxes in the dialog to store them in my data object. I'm not sure how to do it. (i know WHERE; in the event for the "Add" button.)Auria wrote: (Perhaps you should elaborate a little more, it's not always obvious precisely where you're stuck)