If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Auria wrote:Is ListCtrlName a wxString?? You need to append to the wxListCtrl, not to the wxString!! there is no InsertItem method in wxString
Exactly. Sorry for not mentioning that, was doing a quick and dirty post, many things going on today
So what I'm attempting to do right now is collect the name of the listctrl to be updated (currently saved as a wxString). Thing is, I need to convert that to a format that I can use for 'NameGivenByUser->InsertItem(NameGivenByUser->GetItemCount(), String);'. Thats why I asked if I would need to convert it to a char array, which I assume (Would that be what I could use to state the listctrl name?) would be able to be seen as a name of a listctrl.
Auria wrote:Is ListCtrlName a wxString?? You need to append to the wxListCtrl, not to the wxString!! there is no InsertItem method in wxString
Exactly. Sorry for not mentioning that, was doing a quick and dirty post, many things going on today
So what I'm attempting to do right now is collect the name of the listctrl to be updated (currently saved as a wxString). Thing is, I need to convert that to a format that I can use for 'NameGivenByUser->InsertItem(NameGivenByUser->GetItemCount(), String);'. Thats why I asked if I would need to convert it to a char array, which I assume (Would that be what I could use to state the listctrl name?) would be able to be seen as a name of a listctrl.
Thanks again!
FlyingIsFun1217
I just don't understand what you're trying to do. You want the user the enter the name of the pointer to a wxListCtrl object?? Why the hell would you want that? The user is not supposed to know about the name you gave the pointer in your code! If the user needs to choose one in a selection of many, then maybe present a combo box or something like that?
What is your program trying to do?
And: In C++ there is no way you can call anything at runtime by the name it had in compile time. You would nned to go this way:
It just makes it easier for me to know what list control I am inserting the name into.
If I go down the path of telling it what listctrl I want it to update, in the function, I just get that the listctrl was not defined anyway. Obviously it can't see it in ContactManagerFrame.cpp, even when I include the file, and I assume this is because the wxListCtrl is constructed in another class (ContactManagerFrame). If I want one class to access it, should I just make the declaration of it public?
It just makes it easier for me to know what list control I am inserting the name into.
If I go down the path of telling it what listctrl I want it to update, in the function, I just get that the listctrl was not defined anyway. Obviously it can't see it in ContactManagerFrame.cpp, even when I include the file, and I assume this is because the wxListCtrl is constructed in another class (ContactManagerFrame). If I want one class to access it, should I just make the declaration of it public?
Code to follow up soon...
FlyingIsFun1217
You can make it public and access it, but that's not recommended. Use methods to change members. I'm not sure why you want to pass the name as argument. Yo ucan just make a method for a each control. e.g. appendName(wxString name), appendX(wxString X), etc.
Yeah, I think I know how I'll do it.
I'll try just making instancename.UpdateListCtrl(); return the name of the person and from there just insert the persons name into the listctrl within the frame.
Okay you haven't taken me seriously but now please do.
Forget about your app for a while. Forget about wxWidgets for a while. By a while i mean at least 1 or 2 weaks. You will most probably need more to master everything.
You're posting more and more bits of code that doesn't make any sense, you obviously have no idea what you are doing.
So please learn C++ now. When you master writing classes, then come back here.
As i already offered, you can even contact me personnally and i'll be glad to offer help you learning when you're stuck. But i'm not going to provide any more ireplies to this topic since you don't seem to have any clue what you're doing. Furthermore, i even wrote down a model for you and you don't follow it!
I am practicing writing classes, but the only problem is applying what I've learned in the non-wxwidgets classes is so unrelated to the problems that I am dealing with in my app, it doesn't even seem to be like each other except in the format of declaration and functions.
How can I learn classes for (ultimately) wxWidgets projects when I am writing it in standard c++?
FlyingIsFun1217 wrote:I am practicing writing classes, but the only problem is applying what I've learned in the non-wxwidgets classes is so unrelated to the problems that I am dealing with in my app, it doesn't even seem to be like each other except in the format of declaration and functions.
How can I learn classes for (ultimately) wxWidgets projects when I am writing it in standard c++?
Thanks!
FlyingIsFun1217
wxWidgets is standard C++. I don't know what you find so different.
In the latest snippet, you tried calling a method on an ID. If you don't know yo ucan't call methods on an ID, then i think you definitely need to practice more.
Well, after thinking about it, I came up with this...
Why not just make the dialog send a close message to the main frame when it closes, and when the main frame gets this message, just have it refresh the list ctrl?
Saves me much hassle with classes. Which I am still working more on
FlyingIsFun1217 wrote:
Why not just make the dialog send a close message to the main frame when it closes, and when the main frame gets this message, just have it refresh the list ctrl?
Hmm, isn't that exactly what i had suggested right from the start?