Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LIstview subitemns

Status
Not open for further replies.

scoopbh

Programmer
Feb 28, 2003
6
BR
Hi,

I have a listview with some rows:
my listview:
[caption] [subitem1] [subitem2]
row1 green red
row2 blue yellow
row3 etc

question 1)
I want to do this:when a row is clicked, I need to put the text of subitem2 in a label.caption. If I click in row 1 the label.caption will show: red.
If I click in row 2, the label.caption will show: yellow.

question 2)
And, how I do to make unable to resize the headers in a listview?
 
Re question 1):
Code:
procedure TForm1.ListView1Click(Sender: TObject);
begin
  if Assigned(ListView1.Selected) then
    Edit1.Text := ListView1.Selected.SubItems.Strings[1];
end;
Re question 2):
I don't know. Perhaps if you want to go the trouble of using owner-draw, you might be able to over-ride. I didn't explore this, however.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top