Page 1 of 1

wxListBox::FindString issue

Posted: Wed Mar 28, 2018 11:19 am
by gtafan
In the documentation of wxListBox::FindString There is: "Finds an item whose label matches the given string.", but what if there are more then 1 item with such label? I gues it returns the very first item with that label, posibly I am wrong, but how to get the other items with that lebel?

Re: wxListBox::FindString issue

Posted: Wed Mar 28, 2018 12:15 pm
by xaviou
Hi
gtafan wrote:I gues it returns the very first item with that label
You're right.
gtafan wrote:how to get the other items with that lebel?
You'll have to make the search yourself :

Code: Select all

int iCount = myListBox->GetCount();
for (int i=0; i<iCount; ++i)
{
    if (myListBox->GetString(i) == _T("Searched string"))
    {
        // Do what you want with the item at index i
    }
}
Regards
Xav'