TIWListbox how to get Selected Values (Priority support) - Printable Version +- Atozed Forums (https://www.atozed.com/forums) +-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html) +--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html) +---- Forum: English (https://www.atozed.com/forums/forum-16.html) +----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html) +----- Thread: TIWListbox how to get Selected Values (Priority support) (/thread-3111.html) Pages:
1
2
|
TIWListbox how to get Selected Values (Priority support) - valmeras - 04-02-2023 I am using Intraweb 15.2.69 with Rad Studio 10.2.3 How to get all the values or text selected in a TIWListBox when MultiSelect option is true? Because TIWListBox->SelectedValue and TIWListBox->SelectedText are both UnicodeString instead of TStringList! So only one value is returned instead of a list even when multiple values are selected at the same time! RE: TIWListbox how to get Selected Values (Priority support) - valmeras - 04-06-2023 I am supposed to be a priority user! Why I have no response up to today? RE: TIWListbox how to get Selected Values (Priority support) - Alexandre Machado - 04-06-2023 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) RE: TIWListbox how to get Selected Values (Priority support) - Alexandre Machado - 04-07-2023 We are going to extend the TIWCustomListCombo.GetSelectedValue and GetSelectedText to include all elements in a single string (comma delimited) as it works with the TIWSelect control. This modification will be included in the next update RE: TIWListbox how to get Selected Values (Priority support) - valmeras - 04-07-2023 Thanks But why not to have the TIWListBox return a TStringList instead of a UnicodeString? A TStringList will make it easier to retrieve the values. At the contrary of a UnicodeString for which I will need to write a code to separate the values from the commas. RE: TIWListbox how to get Selected Values (Priority support) - MJS@mjs.us - 04-07-2023 >>A TStringList will make it easier to retrieve the values. >>At the contrary of a UnicodeString for which I will need >>to write a code to separate the values from the commas. TStringList contains the property DelimitedText. Assign DelimitedText a string of comma (or any other delimiter) separated values to populate the TStringList, no need to write code to separate the values: Code: auto_ptr<TStringList> s(new TStringList); RE: TIWListbox how to get Selected Values (Priority support) - valmeras - 04-07-2023 I know! I just wanted to avoid to manipulate this kind of staffs like additional variables, pointers specially when working with threads! If the TStringList is a property of the component, it automatically goes with it! RE: TIWListbox how to get Selected Values (Priority support) - Alexandre Machado - 04-07-2023 If I create a TStringList inside the method and return a instance to the calling code you will also have to deal with its destruction and call it inside a try..finally block which is basically an anti-pattern considering this specific scenario. It is a much better and clean code if the calling code creates the TStringList and takes care of its destruction. RE: TIWListbox how to get Selected Values (Priority support) - DanBarclay - 04-12-2023 (04-07-2023, 12:00 AM)Alexandre Machado Wrote: We are going to extend the TIWCustomListCombo.GetSelectedValue and GetSelectedText to include all elements in a single string (comma delimited) as it works with the TIWSelect control. This modification will be included in the next update Is there a condition comma would be in the items? Maybe a non printable, or definable, delimiter? I don't have this problem, just looking considering future issues. Dan RE: TIWListbox how to get Selected Values (Priority support) - Alexandre Machado - 04-15-2023 If comma is in the items, that item will be enclosed in double quotes. Something like what TStringList does |