Entwickler-Ecke

Grafische Benutzeroberflächen (VCL & FireMonkey) - Listbox automatisch scrollen lassen


Jagg - Di 21.06.05 09:18
Titel: Listbox automatisch scrollen lassen
Hallo Leute !

Ich habe eine Listbox in dem Text steht und möchte nun diese automatisch scrollen lassen und zwar von oben nach unten und zwar langsam..das kann man vergleichen wie mit dem Abspann einen KinoFilms...
habe hier schon Forum gesuucht und auch bei google,aber nix brauchbares gefunden...
Ich habe diesen Code gefunden :

Quelltext
1:
SendMessage(ListBox_Info.Handle,WM_VSCROLL,SB_BOTTOM,0);                    

...aber hierbei scrollt er direkt bis zum Ende,ich will aber das er von oben nach unten langsam scrollt...geht das überhaupt oder brauche ich eine andere Komponente ???

MFG
Jagg


JRegier - Di 21.06.05 10:10
Titel: Re: Listbox automatisch scrollen lassen

Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
var I : Real;
    I := 0;
    while I < "ListBox.ScrollBar.Max" do   // Ich weiß jetzt nicht auf anhieb wo ich Max auslese 
    begin
    ListBox.ScrollBy(I, 0);
    I := I + 0,0000001;     // oder so
    end;


Wäre so eine Idee! Bin in Delphi noch nicht so fortgeschritten!
Das Ganze auch als eigenständiger Thread machen damit er nicht das Programm aufhält!

Aber wie werden Threads gemacht?


Tana´Ri - Di 21.06.05 11:00

hast kein SDK?


Auszug zu WM_VSCROLL
Zitat:

wParam
The high-order word specifies the current position of the scroll box if the low-order word is SB_THUMBPOSITION or SB_THUMBTRACK; otherwise, this word is not used.

The low-order word specifies a scroll bar value that indicates the user's scrolling request. This parameter can be one of the following values.

SB_BOTTOM
Scrolls to the lower right.
SB_ENDSCROLL
Ends scroll.
SB_LINEDOWN
Scrolls one line down.
SB_LINEUP
Scrolls one line up.
SB_PAGEDOWN
Scrolls one page down.
SB_PAGEUP
Scrolls one page up.
SB_THUMBPOSITION
The user has dragged the scroll box (thumb) and released the mouse button. The high-order word indicates the position of the scroll box at the end of the drag operation.
SB_THUMBTRACK
The user is dragging the scroll box. This message is sent repeatedly until the user releases the mouse button. The high-order word indicates the position that the scroll box has been dragged to.
SB_TOP
Scrolls to the upper left.
lParam
If the message is sent by a scroll bar, this parameter is the handle to the scroll bar control. If the message is not sent by a scroll bar, this parameter is NULL.


Jagg - Di 21.06.05 11:23

hmmmmm....ja das war nicht so das was ich mir erhofft habe,habe es mit SB_Linedown versucht,er macht das jetzt wie ich will,aber etwas abgehackt,ich will das etwas flüssiger haben...habt ihr eine idee wie ?


Tana´Ri - Di 21.06.05 14:46

Zitat:

Anwendungen rufen die Methode ScrollBy nur selten auf, sofern sie nicht eigene Bildlauffunktionen (anstelle der Verwendung von Bildlaufleisten) implementieren


dann würde ich sagen lag JRegier gar nicht mal so daneben,
wenns zu schnell ist kombiniere das ganze mit sleep(ms)

z.B. (Schleife - ob for oder while je nach deiner Wahl)

Delphi-Quelltext
1:
2:
3:
4:
for i:=0 to ListBox.Items.Count-1 do begin
 ListBox.ScrollBy(0,15);
 sleep(10);
end;


^die Zählervariable könntes du auch verwenden um
dein sleep und/oder die ScrollBy zu variieren.

Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt.