papayrus wrote: PB wrote:
you have to declare your m_pListBox in the wxFrameListBox and create it in its constructor like this:
Code: Select all
class ListBoxFrame : public wxFrame
m_pListBox = new wxListBox(this, ...
The enum was meant to be for numeric case labels for the switch statement. If you go by comparing strings, it's not needed.
As for string comparison, if for some reason simple comparison using == doesn't work for you just use appropriate wxString comparison function.
Anyway, I really recommend to learn C++, you won't get anywhere like this - you're struggling with the language here, not wxWidgets. If you've mastered C#, you should be able to grasp the basics of C++ easily and then build on them fast. If you don't want to learn it, just create the application in the language and framework you're comfortable with.
I am trying to learn it I really am I need some idea of structure on this to move on. I will try what you just showed me. It's definitly different in some ways than c# I want to know C++ as well. If I can make this listbox I can then look at it and figure out what goes where and why and it will help me with other controls as well.
OK I think I got it maybe but where and how can I declare the cases? C1, C2, C3. etc?
Here let me show you what I did first.
In the file ListBoxMain.h I added
under where it says private. Then in the file ListBoxMain.cpp I made this into this.
Code: Select all
m_pListBox = new wxListBox(this, ID_LISTBOX1, wxPoint(24,32), wxSize(328,144), 0, 0, 0, wxDefaultValidator, _T("ID_LISTBOX1"));
now I just need to declare the cases c1, c2, c3 etc
Also I just noticed that my appended text does not show up. If I comment out the code area that says I need to declare c1 c2 and c3 it runs fine but no appended text there.
Can someone send me an example of a frame with a listbox on it with some items add one button to the frame and then make it so when i highlight the first item and press the button it opens notepad and then when I highlight and press the button on the second item it opens IE and when I highlight and press the third button it makes a messagebox please? Or what else can I do here to declare the cases of c1 c2 and c3?