Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TIWListbox how to get Selected Values (Priority support)
#3
SelectedValue and SelectedText are utility methods to retrieve a single selected item in all TIWCustomListCombo descendants (which include all IWComboBoxes and ListBoxes)

In order to retrieve a list with the selected items you can do (in C++):


Code:
void ListBoxGetSelectedValues(TIWListBox* listBox, TStringList* selectedValues)
{
    if (listBox->MultiSelect)
    {
        for (int i = 0; i < listBox->Items->Count; i++)
        {
            if (listBox->Items->Selected[i])
            {
                if (listBox->ItemsHaveValues)
                {
                    selectedValues->Add(listBox->Items->ValueFromIndex[i]);
                }
                else
                {
                    selectedValues->Add(listBox->Items->Strings[i]);
                }
            }
        }
    }
    else
    {
        selectedValues->Add(listBox->GetSelectedValue());
    }
}
Reply


Messages In This Thread
RE: TIWListbox how to get Selected Values (Priority support) - by Alexandre Machado - 04-06-2023, 11:01 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)