On Mon, 2005-09-12 at 15:58 +0200, A.J. Venter wrote:
> Hi all,
> A Quick question, I know how to find out which item in a TListBox was select 
> with single selection. Now however, I wish to do a multi-selecting one, how 
> can I determines which ITEMS were selected.
> 
> Ideally I need to be able to feed all the selected items into a loop and step 
> over them one by one. Does A TlistItem have a ''selected'' property ? Would 
> doing a for loop over the TListBox.Items testing for selected work ?
A listbox also has a selected property. You can check if an item is
selected by checking the corresponding selected instance. Like:
begin
  for I := 0 to (ListBox1.Items.Count - 1) do begin
    if ListBox1.Selected[I] do 
      ShowMessage(ListBox1.Items[I] + ' is selected');
  end;
end;
-- 
Matthijs Willemstein <[EMAIL PROTECTED]>


_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to