Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

que about listbox in delphi 7

DieZzDieZz Member Posts: 1
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

  • zibadianzibadian Member Posts: 6,349
    : 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..

    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]
Sign In or Register to comment.