Autor Beitrag
tc4xe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 55



BeitragVerfasst: Mo 03.07.06 15:05 
Wie kann ich meinen Programm auf einen Klick auf einem Item im ListView reagieren lassen?
Mfg!
crowley
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 406

Win XP, Win Vista, Mandriva, Ubuntu
Delphi 4-8, Delphi 2006, Delphi 2007
BeitragVerfasst: Mo 03.07.06 15:11 
Im OnClick- Ereignis prüfen, ob ItemIndex > -1
tc4xe Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 55



BeitragVerfasst: Mo 03.07.06 15:21 
Ich habe dich nicht verstanden im Onclick ereignis ist jetzt nichts eingetragen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.ListView1Click(Sender: TObject);
begin

end;


StatusIndex ist -1...
crowley
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 406

Win XP, Win Vista, Mandriva, Ubuntu
Delphi 4-8, Delphi 2006, Delphi 2007
BeitragVerfasst: Mo 03.07.06 15:23 
schau mal in der hilfe nach, was das OnClick Ereignis bewirkt...

da drin kannst du dann von deiner Listbox den ItemIndex abfragen... dass ist der Index (die Nummer) des Eintrages, den du gerade angeklickt hast... hast du keinen Eintrag angeklickt, sondern irgendwo in den "leeren" Raum der Listbox, bekommst du den ItemIndex -1
tc4xe Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 55



BeitragVerfasst: Mo 03.07.06 15:33 
Ich kann den Eintrag nicht anklicken. wenn ich es versuche klicke ich den ListView allgemein an!
crowley
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 406

Win XP, Win Vista, Mandriva, Ubuntu
Delphi 4-8, Delphi 2006, Delphi 2007
BeitragVerfasst: Mo 03.07.06 15:39 
ja ? sicher klickst du die ListBox allgemein an... aber du wertest doch mit dem ItemIndex aus, welchen Eintrag du angeklickt hast o_O
tc4xe Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 55



BeitragVerfasst: Mo 03.07.06 15:52 
Wie kommst du auf ListBox die Frage war für ListView
crowley
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 406

Win XP, Win Vista, Mandriva, Ubuntu
Delphi 4-8, Delphi 2006, Delphi 2007
BeitragVerfasst: Mo 03.07.06 15:58 
oups... mein fehler ;)

dann ist es aber noch einfacher...

gibt genug Ereignisse dafür ...

OnChange
OnSelectItem
oder auch hier OnClick


und welches derzeit ausgewählt ist, bekommst du mit ItemFocused heraus... respektive mit ItemIndex oder auch Selected ...

C.