Page 1 of 1

Selecting Listbox item

Posted: Thu Jun 07, 2012 12:05 pm
by rafae11
panel.png
panel.png (34.14 KiB) Viewed 899 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

Re: Selecting Listbox item

Posted: Thu Jun 07, 2012 12:53 pm
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();
}



Re: Selecting Listbox item

Posted: Thu Jun 07, 2012 1:30 pm
by rafae11
Thanks alot that works.