Autor Beitrag
rafi@work
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 147

Win2000 Prof
D7 Enterprise
BeitragVerfasst: Mi 04.08.04 14:43 
Hallo zusammen

Ich klicke auf den untersten Eintrag und möchte, dass es dann einen Button Disabled.
Mit dem property TopItem der Listview konnte ich es wunderbar beim Klick für das oberste Elemen realisiern.
Leider gibt es IMHO kein property dass den untersten selektierten Eintrag ermittelt.

Vielen Dank für eure Hilfe!

mfg
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Mi 04.08.04 14:47 
Hallo

was verstehst du unter dem untersten Element?
- das allerletzte der items? -> index:=listview.items.count-1
- das letzte sichtbare? -> index:=listview.topitem.index+listview.visiblerowcount

mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
rafi@work Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 147

Win2000 Prof
D7 Enterprise
BeitragVerfasst: Mi 04.08.04 14:51 
hallo keldorn

Das letzte sichtbare Element in der Komponente ListView.

Gruss
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Mi 04.08.04 14:53 
ok, dann eben dieses index:=listview.topitem.index+listview.visiblerowcount , sollte gehen :)

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
rafi@work Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 147

Win2000 Prof
D7 Enterprise
BeitragVerfasst: Mi 04.08.04 15:03 
danke! aber es geht leider nicht. die variable 'index' gibt bei mir keinen Wert zurück.

Gruss
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Mi 04.08.04 15:12 
also bei geht folgendes:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.Button7Click(Sender: TObject);
var index:integer;
begin
  index:=ListView1.TopItem.index+ListView1.VisibleRowCount-1;  //m,it dem -1 ein wenig experimentieren, visiblerowcount zählt nur vollständig sichtbare Zeilen
  index:=min(index,ListView1.Items.Count-1); //listview enthält evtl nicht so viele Einträge
  ShowMessage(inttostr(index)+' - '+listview1.items[index].Caption);
end;


Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
rafi@work Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 147

Win2000 Prof
D7 Enterprise
BeitragVerfasst: Mi 04.08.04 15:24 
Vielen Dank, musste nur noch die Unit Math für die Funktion min ins uses reintun und jetzt gehts :D

Gruss