Autor Beitrag
sTk
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

Win 2000, Win XP
Turbo Delphi Pro, D2005 PE, Lazarus
BeitragVerfasst: Mi 07.12.05 08:03 
Hi,

Ich habe ein ListView mit Einträgen gefüllt.
Jetzt kann ich per Klick einzelne Items auswählen, mit der Eigenschaft SelectItem. So weit so gut, nur kann ich ja nicht zwei mal hintereinander auf eine Zeile klicken, da diese noch selektiert ist. Ich dachte mir dann, mit ListView.ClearSelection müßte es doch einfach gehen, die Selektion aufzuheben. Also habe ich das am Ende der Procedure eingefügt. Nur jetzt durchläuft er die Procedure zwei mal, weil er das Deselektieren wahrscheinlich auch noch als Aktion auffasst.
Gibt es da eine Möglichkeit, wie ich das anders löse?

Danke und Gruß, Steffen
digi_c
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Mi 07.12.05 08:08 
Könntest du nicht eine Abfrage rum bauen ob diese Item selektiert ist und wenn es selektiert ist macht er die weiteren Abfragen?
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mi 07.12.05 08:57 
Hallo,
user profile iconsTk hat folgendes geschrieben:
... So weit so gut, nur kann ich ja nicht zwei mal hintereinander auf eine Zeile klicken, da diese noch selektiert ist....

warum kannst Du nicht zwei mal hintereinander auf eine Zeile klicken?
Das Ereignis OnClick wird doch ausgeführt, auch wenn das Item schon selectiert ist.
Oder hab ich da etwas falsch verstanden :gruebel:

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
sTk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

Win 2000, Win XP
Turbo Delphi Pro, D2005 PE, Lazarus
BeitragVerfasst: Mi 07.12.05 09:23 
Ich benutze nicht OnClick sondern SelectItem. OnClick geht doch nur für das gesamte ListView oder? Dann muß ich noch irgendwie herausfinden welcher Item geklickt wurde.
Ich bin noch nicht so lang am programmieren, also bitte um etwas Nachsicht bei meinen Fragen ;-)
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mi 07.12.05 09:39 
Hallo,

so, oder ?
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.ListView1Click(Sender: TObject);
begin
  showmessage(ListView1.Selected.Caption);
end;
sTk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

Win 2000, Win XP
Turbo Delphi Pro, D2005 PE, Lazarus
BeitragVerfasst: Mi 07.12.05 10:12 
Jo, Danke!

Es geht auch Listview1.Selected.Subitem[0], was mir wichtig war.

Vielen Dank nochmal!!!