Autor Beitrag
Biarchiv
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 688



BeitragVerfasst: Mo 19.09.05 18:42 
Hey delphianer,

bei folgender Frage weiß ich gar nicht ob sowas möglich ist.

Erstmal erstelle ich ein neues item per: listview.items.add;
Is es möglich diesen letzten item einer listview automatisch zu
markieren?
Sprich wie wenn man selbst per Maus auf den letzen Item klickt.


Weiters wie kann ich nur den ersten columns des letzten items
ermitteln was trin steht?

Vielen Dank...
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mo 19.09.05 18:45 
ausblenden Delphi-Quelltext
1:
listbox1.Selected[Listbox1.Items.Count-1] := True;					

_________________
We are, we were and will not be.
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Di 20.09.05 06:58 
Hallo,

das beispiel von user profile iconGausi ist falsch, da es sich nicht auf eine Listview bezieht. Den letzten Eintrag einer Listview kannst Du wie folgt markieren:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
  ...
  with ListView1 do
  begin
    Selected:=Items[Items.Count-1];

    // 1. Column
    Label1.Caption:=Selected.SubItems[0];
  end; // with ListView1
  ...

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
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: Di 20.09.05 07:21 
Hallo,

wenn Du mit erste Column die erste Spalte der ListView meinst, ist die Caption des Items Dein Ansatzpunkt.
ausblenden Delphi-Quelltext
1:
2:
3:
Label1.Caption:=Selected.Caption;     // >>> Column 0 = Spalte 1
Label1.Caption:=Selected.SubItems[0]; // >>> Column 1 = Spalte 2 
Label1.Caption:=Selected.SubItems[1]; // >>> Column 2 = Spalte 3

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Di 20.09.05 07:40 
kleiner Tipp:
Wenn du das mit selecteddann markiert hast, es aber am Ende des Listviews ist und nur surch scrollen erreichbar ist, wird es nicht angezeigt. Rufe dazu noch die Methode makevisible(false); auf

_________________
In the beginning was the word.
And the word was content-type: text/plain.