Hi guys here's the thing:
I've got a listbox on my form and it contains the names of several images...
how can I get the text on a line in the listbox (the one that I click or dblclick) so I can use it to open that image?
Oh and please excuse my English..
Comments
: I've got a listbox on my form and it contains the names of several
: images...
: how can I get the text on a line in the listbox (the one that I
: click or dblclick) so I can use it to open that image?
:
:
: Oh and please excuse my English..
You can get the clicked item using the TListBox.ItemIndex property. The TListBox.Items property returns all the items in the listbox. If you have multiple selections, then you need to use the TListBox.Selected property.
Here's an example to show which item was clicked:
[code]
procedure TForm1.ListBox1Click(Sender: TObject);
begin
MessageDialog(ListBox1.Items[ListBox1.ItemIndex]);
end;
[/code]