Einzelnen Beitrag anzeigen

Benutzerbild von bitsetter
bitsetter

Registriert seit: 17. Jan 2007
1.169 Beiträge
 
Turbo Delphi für Win32
 
#2

Re: Im ListView OnClick SpaltenIndex heraus finden....

  Alt 31. Jan 2007, 14:39
Delphi-Quellcode:
procedure TForm1.ListView1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
   links, Spalte: integer;
begin
 links:= 0;
 for Spalte:= 0 to ListView1.Columns.Count- 1 do
 begin
   if (links<= x) and (x < (links+ ListView1.Columns.Items[Spalte].Width)) then
   break;
   inc(links, ListView1.Columns.Items[Spalte].Width);
 end;
 Showmessage('Spalte: '+ inttostr(Spalte));
end;
Gruß bitsetter
"Viele Wege führen nach Rom"
Wolfgang Mocker (geb. 1954), dt. Satiriker und Aphoristiker
  Mit Zitat antworten Zitat