Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I made a list listbox in code blocks. I want to do something when I click an item such as open a text file or open internet explorer just something anything. I cant figure it out. Here is my code for my list box.

It tells me that I selected item 0 when I select the first item and item 1 etc down the list. It does not allow me to launch internet explorer or do something when I select an item. I am really thinking that code blocks and wxwidgets is a bad idea being that something this simple seems impossible to find info on.

Any help would be appreciated thanks.



void ListBoxFrame::OnListBox1Select(wxCommandEvent& event)
{
    int sel = event.GetInt();
    wxLogMessage(_T("Listbox item %d selected"), sel);
}




Also I have tried this and can;t get it to work. I would like to get this method working the most. It is in a c# project trying to convert it to wxlistbox code.


void ListBoxFrame::OnListBox1Select(wxCommandEvent& event)
{
for (int i = 0; i < ListBox1.Select.Count; i++)
            {
                switch (ListBox1.Select[i].ToString())
                {
                    case "Foobar":
                        wxLogMessage(_T("Listbox item foobar selected"));
                        break;
                    case "Bazquirk":
                        wxLogMessage(_T("Listbox item Bazquirk selected"));
                        break;
                    case "Widgets":
                        wxLogMessage(_T("Listbox item Widgets selected"));
                        break;
                    case "Gadgets":
                        wxLogMessage(_T("Listbox item Gadgets selected"));

                        break;
                }
            }
}
Posted
Updated 24-Jan-11 4:36am
v6
Comments
Albert Holguin 5-Feb-11 21:33pm    
Can you elaborate on what you mean with the "...does not allow me to launch internet explorer or do something..."? I've never used wxwidgets or code blocks, but under C++ and MFC there would be no problem doing that. What's the actual call that you are trying and does it return any errors?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900