Autor Beitrag
delphinia
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131

XP Pro Sp2
Delphi 5 Standard
BeitragVerfasst: So 12.03.06 01:48 
Mein Problem ist, wie bekomme ich das Item in der Liste heraus, auf dem der Mauszeiger gerade sich befindet!

Danke Euch
ralph
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 57

openSUSE 10.3 mit Crossover Linux 6.2
Delphi 3 Pro, Freereport 2.32
BeitragVerfasst: So 12.03.06 05:20 
Titel: Es ist das Ereignis OnChange der ListView
Hallo delphinia,

habe es gerade gebraucht, es ist das Ereignis OnChange der TListView. Versuch mal folgenden Code:

LV_Tabellen ist der Name der Listview:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TFRM_Kopiere_Tabelle.LV_TabellenChange(Sender: TObject; Item: TListItem;
  Change: TItemChange);
begin

if (LV_Tabellen.Selected <> nil) then

Edit_Tabellenname.Text  :=  LV_Tabellen.Selected.Caption;

oder

// Button1.Caption := LV_Tabellen.Selected.Caption;

// Label1.Caption := LV_Tabellen.Selected.Caption;

end;


Gruß Ralli
delphinia Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131

XP Pro Sp2
Delphi 5 Standard
BeitragVerfasst: So 12.03.06 08:16 
hmmm genau sowas hatte ich auch schon rausgefunden

Nur ein Problem ich möchte herausfinden welches Item OHNE das die Maus geklickt werden muss - ich möchte das während sie bewegt wird!


hatte daher das schon in die OnMove gepackt nur da erhalte ich Zugriffsverletzungen wenn ich mich zwischen 2 Icons befinde
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: So 12.03.06 09:47 
Hallo,

mit OnMouseMove warst Du schon auf dem richtigen Weg.
Die Zugriffsverletzungen kann man durch prüfen mit Assigned(aItem) oder aItem <> nil verhindern.
Ein Beispiel, Ausgabe des Item.Index in der Form.Caption:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.ListView1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var aItem : TListItem;
begin
  aItem := ListView1.GetItemAt(X, Y);
  if Assigned(aItem) then
    Caption := IntToStr(aItem.Index);
end;

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
ralph
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 57

openSUSE 10.3 mit Crossover Linux 6.2
Delphi 3 Pro, Freereport 2.32
BeitragVerfasst: So 12.03.06 19:41 
Titel: Unausgeschlafen
Sorry, ich sollte nicht so früh posten, habe es nicht richtig gelesen.

Ralli