Autor Beitrag
cromos
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 219


Delphi 7
BeitragVerfasst: Sa 23.08.03 08:39 
Hallo,

Habe bei einer ListView im OnClick Ereignis diesen Code:
ausblenden Delphi-Quelltext
1:
lblDatName.Caption:=listview1.Selected.subitems[9];					

Funktioniert auch super. Wenn ich auf einen Bestimmten Eintrag klicke wirde der Inhalt des SubItems im Label dargestellt. So, nun wollte ich das, wenn der Anwender dann anstatt mit der Maus weiterklickt die Pfeiltasten benutzt und in der Listview Scrooled, das immer der Markierte Bereich ausgelesen wird.

Habe deshalb mal obigen Code im OnKeyPressed Ereignis eingesetzt, Leider ohne Erfolg. Auch OnKeyDown und OnKeyUp zeigten keinerlei Wirkung.

Was mache ich falsch? Bzw. Wo sollte ich den Code hinsetzten?

Gruss
Cromos
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: Sa 23.08.03 10:10 
Hallo

gugg dir mal das Ereignis Listview onchange an und schreib deinen Code da rein.

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
cromos Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 219


Delphi 7
BeitragVerfasst: Sa 23.08.03 13:56 
Titel: geht nicht
Dann bekomme ich eine Exception
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: Sa 23.08.03 15:11 
hast auch geprüft, daß selected<>nil ist?

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
cromos Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 219


Delphi 7
BeitragVerfasst: Sa 23.08.03 15:51 
Ja hab ich.

Das gleiche Ergebnis. Exception.

Komischerweise funktioniert es beim OnCklick ereignis dadellos.
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: Sa 23.08.03 18:57 
poste mal bitte dein komplettes onchange ereignis

welche Delphi-version hast du?

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
cromos Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 219


Delphi 7
BeitragVerfasst: So 24.08.03 12:25 
Habe Delphi version 7

Der code:

ausblenden Quelltext
1:
2:
3:
4:
5:
  begin
if ListView1.ItemIndex = -1 then
  exit
else
 lblDatName.Caption:=listview1.Selected.subitems[9];


Aber es klappt jetzt. In OnChange ereignis. Hatte ich bis jetzt noch nicht Probiert, oder habe geadacht ich hätte es Probiert. :D

Danke und Gruss
Cromos