Autor Beitrag
TOMahawk85
Hält's aus hier
Beiträge: 15

WinXP
Delphi 2005
BeitragVerfasst: Do 01.06.06 14:35 
Hallo euch allen,

da mir die Suche nicht weiterhelfen konnte, muss ich eben fragen.

Ich möchte ein Item mitten in einer ListBox, das per Mausklick markiert wird, mit dem nachfolgenden oder dem vorhergehenden (je nach Button) vertauschen.
Wie kann das Programm erkennen, welches Item einer ListBox ich angeklickt habe?

Ich danke schonmal für die Hilfe.
Arno Nym
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131



BeitragVerfasst: Do 01.06.06 14:48 
Hi!
Ich bin mir zwar sicher das es schon hier im Forum steht, aber die Lösung lautet einfach "Listbox1.ItemIndex"
MFG, Arno Nym
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: Do 01.06.06 16:09 
Hallo,

z.B. mit dem nächsten tauschen:
ausblenden Delphi-Quelltext
1:
ListBox.Items.Exchange(ListBox.ItemIndex,ListBox.ItemIndex+1);					

Achtung, abfangen wenn ItemIndex das letzte Item in der Listbox ist!

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )