Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Python ListBox
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 24-Jan-11 2:34am
Edited 24-Jan-11 5:36am
(no name)18.2K
v6
Comments
Albert Holguin at 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)

  Print Answers RSS
0 OriginalGriff 410
1 Sergey Alexandrovich Kryukov 329
2 Afzaal Ahmad Zeeshan 264
3 BillWoodruff 235
4 CPallini 195
0 OriginalGriff 5,560
1 DamithSL 4,476
2 Maciej Los 3,942
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 24 Jan 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100