In ScrollAreaGadget() zu Position 0,0 springen
Verfasst: 18.07.2005 15:17
Geht das? Finde bei den Gadgets nichts dazu... bleibt wohl nur WinAPI übrig, falls überhaupt? Oder das ScrollAreaGadget einfach nochmal neu zeichnen?
Das deutsche PureBasic-Forum
https://www.purebasic.fr/german/
Code: Alles auswählen
int SetScrollPos(
HWND hWnd, // handle of window with scroll bar
int nBar, // scroll bar flag
int nPos, // new position of scroll box
BOOL bRedraw // redraw flag
);
Code: Alles auswählen
SetScrollPos_(gadgetid(#gadget), #SB_VERT, 0, #true)
SetScrollPos_(gadgetid(#gadget), #SB_HORZ, 0, #true)
Fett markierte Stelle: Angabe des 1. Gadgets im ScrollAreaGadget.Structure PB_ScrollAreaData
ScrollAreaChild.l
ScrollStep.l
EndStructure
Procedure ScrollScrollArea(gadget, xoffset, yoffset, redraw.b)
hScrollArea = GadgetID(gadget)
*SAGdata.PB_ScrollAreaData = GetWindowLong_(hScrollArea, #GWL_USERDATA)
If *SAGdata
posX = GetScrollPos_(hScrollArea, #SB_HORZ)
posY = GetScrollPos_(hScrollArea, #SB_VERT)
SetScrollPos_(hScrollArea, #SB_HORZ, posX + xoffset, #True)
SetScrollPos_(hScrollArea, #SB_VERT, posY + yoffset, #True)
posX = GetScrollPos_(hScrollArea, #SB_HORZ)
posY = GetScrollPos_(hScrollArea, #SB_VERT)
GetWindowRect_(*SAGdata\ScrollAreaChild, wr.RECT)
MoveWindow_(*SAGdata\ScrollAreaChild, -posX, -posY, wr\Right - wr\Left, wr\Bottom - wr\Top, #True)
If redraw
UpdateWindow_(GadgetID(4646))
EndIf
EndIf
EndProcedure
Aufruf zum Runterspringen (fette Stelle Gesamtlänge):ScrollScrollArea(#GadgetID,0,-27640,true)
ScrollScrollArea(#GadgetID,0,27640,true)