Autor Beitrag
whitef
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 202
Erhaltene Danke: 1

Windows X
Delphi XE X
BeitragVerfasst: Di 14.10.08 21:41 
hi,
habe in meinem projekt eine ListBox die ich mittels OpenFolder mit Pfaden fülle.
Nun möchte ich das der letzte hinzugefügte Pfad markiert ist.
Kann mir jemand sagen wie ich das mache?

so markiert er mir ja alles

ausblenden Delphi-Quelltext
1:
2:
for i:=Listbox.Items.Count-1 downto 0 do
Listbox.Selected[i] := true;

aber wie bleibt er bei dem letzten eintrag der vorhanden ist stehen?

mfg
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 14.10.08 21:43 
Moin!

Probier das mal so: ;)
ausblenden Delphi-Quelltext
1:
2:
ListBox1.ClearSelection;
ListBox1.Selected[ListBox1.Count-1] := TRUE;

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Di 14.10.08 21:46 
ausblenden Delphi-Quelltext
1:
ListBox1.ItemIndex := ListBox1.Items.Count-1;					

Noch kürzer. ;)
whitef Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 202
Erhaltene Danke: 1

Windows X
Delphi XE X
BeitragVerfasst: Di 14.10.08 21:54 
funktioniert einwandfrei... Vielen Dank!
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 15.10.08 00:07 
Hallo,

und so kannst Du beim Füllen, wenn es über eine Schleife läuft, immer direkt den letzten Eintrag markieren.
ausblenden Delphi-Quelltext
1:
ListBox1.ItemIndex := ListBox1.Items.Add('Hallo');					

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

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Mi 15.10.08 15:18 
naja, auch nicht so optimal weil dann bei jedem schleifendurchgang erneut das letzte markiert wird. ich würde es wenn dann nach die schleife setzen und so machen wie Yogu.

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
DeddyH
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 15.10.08 15:46 
Oder so:
ausblenden Delphi-Quelltext
1:
Listbox.Perform(WM_VSCROLL, SB_BOTTOM, 0);					
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Mi 15.10.08 15:51 
scrollt das die listbox nicht einfach nur ganz runter? weil eigentlich war je das markieren des letzten elements gefragt.

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
DeddyH
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 15.10.08 16:08 
Stimmt, nicht richtig gelesen.