Selecting Listbox item Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
rafae11
Experienced Solver
Experienced Solver
Posts: 85
Joined: Sat Jun 02, 2012 8:41 am

Selecting Listbox item

Post by rafae11 »

panel.png
panel.png (34.14 KiB) Viewed 1288 times
i have a list box and i want to be able to select an item from the list by the index of the item on the list
when i select the it. i would want to hide or show a panel.

could someone please give me a simple example of how to select an item on a list and what syntax to use.
on selecting a particular item on a listbox

Code: Select all

void Frame::OnListBox(wxCommandEvent& event);
{
   if (listboxitem == 1)
        {panel1->show();
          panel2->hide();
         }

 if (listboxitem ==2)
       {panel1->hide();
        panel2->show();
       }
}
thanks
Mojo
Super wx Problem Solver
Super wx Problem Solver
Posts: 401
Joined: Wed Sep 21, 2005 8:17 am
Location: Rostov-on-Don, Southern Russia

Re: Selecting Listbox item

Post by Mojo »

Panel2 is hidden in Frame ctor

Code: Select all

void Frame::OnListBox(wxCommandEvent& event);
{
   if (m_listBox1->IsSelected(1))
        {
           panel1->Hide();
          panel2->Show();
         }
    else
       {
         panel1->Show();
        panel2->Hide();
       }


event.Skip();
}


Win XP HE SP3, Vista
Xubuntu 12.04 LTS
wxWidgets-2.9.5
wxWidgets-3.0.0
rafae11
Experienced Solver
Experienced Solver
Posts: 85
Joined: Sat Jun 02, 2012 8:41 am

Re: Selecting Listbox item

Post by rafae11 »

Thanks alot that works.
Post Reply