Search found 204 matches

by papayrus
Wed Jan 26, 2011 9:47 pm
Forum: C++ Development
Topic: wxlistbox Arrays with CASE and SWITCH not working
Replies: 22
Views: 8267

Well I made it work. I don;t know if this is correct but it works. I changed the c1 c2 c3 in case to numbers 1 ,2 ,3 etc and it works. Here is the final code. void ListBoxFrame::OnListBox1Select(wxCommandEvent& event) { int expr = event.GetInt(); switch (expr) { case 0: system("start c:\\pr...
by papayrus
Wed Jan 26, 2011 8:49 pm
Forum: C++ Development
Topic: wxlistbox Arrays with CASE and SWITCH not working
Replies: 22
Views: 8267

you have to declare your m_pListBox in the wxFrameListBox and create it in its constructor like this: class ListBoxFrame : public wxFrame { ... private: wxListBox* m_pListBox; ... } ListBoxFrame::ListBoxFrame(...) { ... m_pListBox = new wxListBox(this, ... } The enum was meant to be for numeric cas...
by papayrus
Wed Jan 26, 2011 8:39 pm
Forum: C++ Development
Topic: wxlistbox Arrays with CASE and SWITCH not working
Replies: 22
Views: 8267

you have to declare your m_pListBox in the wxFrameListBox and create it in its constructor like this: class ListBoxFrame : public wxFrame { ... private: wxListBox* m_pListBox; ... } ListBoxFrame::ListBoxFrame(...) { ... m_pListBox = new wxListBox(this, ... } The enum was meant to be for numeric cas...
by papayrus
Wed Jan 26, 2011 7:50 pm
Forum: C++ Development
Topic: wxlistbox Arrays with CASE and SWITCH not working
Replies: 22
Views: 8267

I added wxListBoxCtrl* m_pListBox; to under where it says Initialize(ListBoxFrame) ListBoxFrame::ListBoxFrame(wxWindow* parent,wxWindowID id) { //(*Initialize(ListBoxFrame) and made my button like this void ListBoxFrame::OnButton5Click(wxCommandEvent& event) { wxArrayInt selections; m_pListBox.G...
by papayrus
Wed Jan 26, 2011 4:31 pm
Forum: C++ Development
Topic: wxlistbox Arrays with CASE and SWITCH not working
Replies: 22
Views: 8267

Not tested, but it should work... wxArrayInt selections; ListBox1.GetSelections(selections); for (int i = 0; i < selections.GetCount(); i++) { wxString current_str = ListBox1.GetString(selections.Item(i)); if (current_str == "Foobar") { wxMessageBox(_T("Listbox item foobar selected&q...
by papayrus
Wed Jan 26, 2011 3:05 pm
Forum: C++ Development
Topic: wxlistbox Arrays with CASE and SWITCH not working
Replies: 22
Views: 8267

I did google it. I am just becoming more clear at what I am seeing here now. Thank you for that info it's almost good. I have one more error to fix in my code and I am stumped on why I am getting the error. The error tells me that c1 and c2 and c3 and c4 were not declared in this scope. Here is my ...
by papayrus
Tue Jan 25, 2011 11:18 pm
Forum: C++ Development
Topic: wxlistbox Arrays with CASE and SWITCH not working
Replies: 22
Views: 8267

I did google it. I am just becoming more clear at what I am seeing here now. Thank you for that info it's almost good. I have one more error to fix in my code and I am stumped on why I am getting the error. The error tells me that c1 and c2 and c3 and c4 were not declared in this scope. Here is my c...
by papayrus
Tue Jan 25, 2011 9:55 pm
Forum: C++ Development
Topic: wxlistbox Arrays with CASE and SWITCH not working
Replies: 22
Views: 8267

OK I been doing more research on it. I see that it's not really a C++ thing to use strings in this manner. So I broke down code from samples that came with wxdev but I am using code blocks anyway they all break down to this. int sel = event.GetInt(); wxLogMessage(_T("Listbox item %d selected&qu...
by papayrus
Tue Jan 25, 2011 5:14 pm
Forum: C++ Development
Topic: wxlistbox Arrays with CASE and SWITCH not working
Replies: 22
Views: 8267

wxlistbox Arrays with CASE and SWITCH not working

Hello I need help I been trying to make a list box like one I made in C# where you select and item in the listbox and then press a button and it does something like launch internet explorer. In my program I just have a button and a wxlistbox on the frame. I want to make a number of items and when ea...