User forums > Using Code::Blocks

wxlistbox Arrays with CASE and SWITCH not working

(1/3) > >>

papayrus:
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 each item is selected each one will do something different when the button is clicked. Here is my code so far it does not work. Thanks for any help.


--- Code: ---void ListBoxFrame::OnButton3Click(wxCommandEvent& event)
{

           for (int i = 0; i < ListBox1.IsSelected.Count; i++)
            {
                switch (ListBox1.IsSelected[i].ToString())
                {
                    case "Foobar":
                        wxMessageBox(_T("Listbox item foobar selected"));
                        break;
                    case "Bazquirk":
                        wxMessageBox(_T("Listbox item Bazquirk selected"));
                        break;
                    case "Widgets":
                        wxMessageBox(_T("Listbox item Widgets selected"));
                        break;
                    case "Gadgets":
                        wxMessageBox(_T("Listbox item Gadgets selected"));

                        break;
                }
            }
}
--- End code ---

oBFusCATed:
I would have written this:

--- Quote ---Ask in the wxWidgets' forum.
Here we discuss topics related to the IDE C::B.
Not how to program with toolkit/library X.

--- End quote ---

But then I've realized that you need to find a good C++ book.

papayrus:
No time for a good c++ book right now. Just want to make that code work. Can you send me a link to the wxwidgets forum I can't seem to find it in here.
I forgot to add I am using wxpack.

oBFusCATed:
Hm, www.google.com ?

Also read the error messages that the compiler has emitted to help you fix you problem without the need to bother anyone else.

papayrus:
Obviously I know all that I am a c# programmer. My code there is not too far off I can tell you that. You a typical useless retard. Use google oh oh I am so wise to tell people that oh oh I am the nerd king and tell everyone to use google thats the answer to all my problems. Buddy if you don't know how to do it don't comment at all. Nobody in the world needs to be told to use google anymore that's the answer of of lazy psychotic sadistic moron.

Navigation

[0] Message Index

[#] Next page

Go to full version