Autor Beitrag
Deerfield
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35


Delphi XE Pro
BeitragVerfasst: Fr 19.05.06 09:18 
Hallo,

es ist ja ziemlich einfach, mittels ItemIndex die "Zeilennummer" einer selektierten Zeile zu bestimmen, doch wie bekomme ich den ItemIndex eines Elements einer beliebigen ListBox-Ansicht (meinetwegen 500 Einträge, Liste quasi in die Mitte gescrollt), heraus, wenn gar nichts selektiert wurde?

2. Problem Wenn Items hinzugefügt werden, wird automatisch die Liste aktualisiert und die Ansicht auf das erste Element gesetzt. Mit TopIndex könnte ich mittels Items.Count-1 auch auf die aktuellste Position fokussieren, doch was ist, wenn ich die Ansicht - unabhängig, ob nun hinzugefügt wird, oder nicht - quasi 'einfrieren' will, d.h. weiter unten werden zwar Einträge hinzugefügt, meine (gescrollte) Ansicht bleibt jedoch unbeeindruckt davon.
Normalerweise würde nen Property reichen, falls ichs übersehen hab' - bitte steinigt mich nicht ;-)

Auf Antwort hoffend
Gruß!

Deerfield
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: Fr 19.05.06 10:27 
Hallo,

dann speicher Dir doch den TopIndex in einem Integer oder in der Tag-Eigenschaft der ListBox, nach der Aktualisierung setzt Du dann den TopIndex wieder auf den zwischengespeicherten Wert.

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Deerfield Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35


Delphi XE Pro
BeitragVerfasst: Fr 19.05.06 10:42 
*g* genau das habe ich ja vor, doch wo bitte soll ich den TopIndex herbekommen, wenn ich mitten in die Liste gescrollt habe bzw. gibt es ein Scroll-Ereignis?
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: Fr 19.05.06 10:59 
Hallo,

bevor Du Items hinzufügst kannst du doch den TopIndex speichern :gruebel:

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Deerfield Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35


Delphi XE Pro
BeitragVerfasst: Fr 19.05.06 11:18 
Das ganze läuft mittels Timer, welcher alle 200ms die Ansicht aktualisiert. Wenn ich in der Liste hochscrolle, soll die Ansicht "festgehalten" werden, ich darf die Variable also nur dann speichern/verändern, wenn ich die Ansicht verändert habe, d.h. gescrollt hab'.
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: Fr 19.05.06 12:09 
Hallo,

dann speicher den TopIndex doch in der Timer-Procedur.

Ansonsten hilft Dir das Stichwort Suche bei Google DELPHI AND LISTBOX AND WM_VSCROLL sicher weiter.
z.B. :arrow: List Box Scroll - Status

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Deerfield Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35


Delphi XE Pro
BeitragVerfasst: Fr 19.05.06 12:13 
Habs jetzt so, wie ichs haben will. Danke! :-)
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: Fr 19.05.06 12:18 
Hallo,
user profile iconDeerfield hat folgendes geschrieben:
Habs jetzt so, wie ichs haben will. Danke! :-)

wäre nett wenn Du das hier auch erklären könntest, wie Du das gemacht hast.
Nehme an das es andere User auch interresiert :wink:

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