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.
I have used GetSelections to get the indexes of all the selected items in a ListBox. But now I need to get the indexes of all items, selected or unselected. I didn't find a function for that or maybe I just missed it.
Thanks in advance
Thomas
EDIT:
I just use GetString(int) now. But I have a problem: I try to fill a wxArrayString in a loop but always get an error:
wxArrayString Printers;
int items_count = ListBox2->GetCount();
int i = 0;
do
{
Printers = ListBox2->GetString(i);
}
while(i < items_count);
Error:
no match for 'operator=' (operand types are 'wxArrayString' and 'wxString')|
candidate is:
wxArrayString& wxArrayString::operator=(const wxArrayString&)|
no known conversion for argument 1 from 'wxString' to 'const wxArrayString&'|
The do-while loop is no good here, as it will execute the body once even if there is no item in the list (and you're not incrementing i). Use a good-ole for-loop.
Oh, it's so easy. I even did use the "Add" version but didn't get it to work as I thought that the item's index wasn't just the simple number from 0 to xy.
For the incremetion of i... that was just missing because I reproduced the code for the forum (as I had already found another solution with an ordinary wxString array). So I just forget while being a bit in a hurry
But the do-while-loop thing... I don't even know why I thought I had to use a do-while loop. I'm glad you made that clear so I could change my code in another part as well