Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi [TListBox] Aktuelle Scrollzeile (https://www.delphipraxis.net/86283-%5Btlistbox%5D-aktuelle-scrollzeile.html)

bitsetter 13. Feb 2007 21:35

Re: [TListBox] Aktuelle Scrollzeile
 
Ja genau das meinte ich, das ist was die procedure ausgerechnet hat.

Nils_13 14. Feb 2007 14:31

Re: [TListBox] Aktuelle Scrollzeile
 
Deine neue Prozedur zum Runterscrollen macht jetzt alles perfekt. :) Jetzt ist halt noch die Frage, was man wegen dem Hochscrollen tun könnte.

bitsetter 14. Feb 2007 22:33

Re: [TListBox] Aktuelle Scrollzeile
 
Stell doch mal deine neue Demo zum Download bereit, will mal sehen wie es jetzt aussieht.

Nils_13 15. Feb 2007 17:56

Re: [TListBox] Aktuelle Scrollzeile
 
Liste der Anhänge anzeigen (Anzahl: 1)
Hier ist sie:

bitsetter 15. Feb 2007 19:46

Re: [TListBox] Aktuelle Scrollzeile
 
Liste der Anhänge anzeigen (Anzahl: 1)
Du benutzt für das Hoch- und Runterscrollen anscheinend 2 verschiedene Proceduren. Wenn man bei dir erst runterscrollt, und dann wieder hochscrollt, dann macht deine Trackbar einen großen Sprung.
Hast du schon einmal versucht, für das Hoch- und Runterscrollen, die gleiche Procedur zu nehmen?
Ich habe noch ein primitives Beispiel geschrieben, da ich nicht deine Listbox habe, musste ich mich mit einem Timer behelfen. Der Timer soll die Scrollmessage ersetzen.
Die Trackbar hatte jedenfalls beim scrollen immer die richtige Position.

Nils_13 15. Feb 2007 20:12

Re: [TListBox] Aktuelle Scrollzeile
 
:oops:
Ich hatte noch zwei If-Abfragen und noch einen etwas anderen Code:
Delphi-Quellcode:
if ScrollCode = scLineDown then
begin
  ZeroMemory(@WinInfo, sizeOf(WinInfo));
  WinInfo.cbSize    := SizeOf(WinInfo);
  GetWindowInfo(lbList.Handle, WinInfo);
  iHeight           := WinInfo.rcClient.Bottom - WinInfo.rcClient.Top;
  xiScrollV.Max     := (lbList.Count * lbList.ItemHeight - iHeight) div lbList.ItemHeight + 1;
  Rect              := lbList.ItemRect(0);
  xiScrollV.Position := (Rect.Top div lbList.ItemHeight* -1)
end else
if if ScrollCode = scLineUp then
begin
  ZeroMemory(@WinInfo, sizeOf(WinInfo));
  WinInfo.cbSize    := SizeOf(WinInfo);
  GetWindowInfo(lbList.Handle, WinInfo);
  iHeight:= WinInfo.rcClient.Top - WinInfo.rcClient.Bottom;
  xiScrollV.Max     := (lbList.Count * lbList.ItemHeight - iHeight) div lbList.ItemHeight + 1;
  Rect              := lbList.ItemRect(0) ;
  xiScrollV.Position := (Rect.Bottom div lbList.ItemHeight * -1);
end;
Danke, jetzt funktioniert alles!


Alle Zeitangaben in WEZ +1. Es ist jetzt 21:04 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz