ScrollAreaGadget et #WM_VSCROLL
Publié : dim. 12/sept./2004 11:31
Bonjour,
En complément du post suivant :
http://purebasic.hmt-forum.com/viewtopi ... tscrollpos
...comment récupérer l’événement d’un déplacement de la barre verticale ou horizontale d’un gadget container ?
Par exemple, l’événement #WM_VSCROLL est sensé etre émis pour toute manipulation d’une barre vertical de scroll, non ?
Cela a t’il un rapport avec le fait que PB gère les barres de scroll lui-meme ? (filtrage ?)
En complément du post suivant :
http://purebasic.hmt-forum.com/viewtopi ... tscrollpos
...comment récupérer l’événement d’un déplacement de la barre verticale ou horizontale d’un gadget container ?
Par exemple, l’événement #WM_VSCROLL est sensé etre émis pour toute manipulation d’une barre vertical de scroll, non ?
Cela a t’il un rapport avec le fait que PB gère les barres de scroll lui-meme ? (filtrage ?)
Code : Tout sélectionner
InitSprite()
Procedure WindowCallback(WindowID, Message, wParam, lParam)
Result = #PB_ProcessPureBasicEvents;Result= DefWindowProc_(WindowID, Message, wParam, lParam)
;Debug Str(message)+" / "+Str(#WM_VSCROLL)
Select Message
Case #WM_VSCROLL; Gestion de la barre verticale
Debug "#WM_VSCROLL"
Debug WindowID
EndSelect
ProcedureReturn Result
EndProcedure
If OpenWindow(0,0,0,400,300,#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget,"Window")
SetWindowCallback(@WindowCallback())
If CreateGadgetList(WindowID(0))
ScrollAreaGadget (1,10,10,200,200,500,400,10)
hCont = ContainerGadget(2,10,10,500,400,#PB_Container_Double)
CloseGadgetList()
If OpenWindowedScreen( hCont, 0, 0, 500, 400, 0, 0, 0 ) = 0
MessageRequester( "Erreur" , "Impossible d'ouvrir l'écran " , 0 )
End
EndIf
EndIf
If CreateSprite(1000,24,24)
StartDrawing(SpriteOutput(1000))
Box(0,0,24,24,RGB($0,$0,$FF))
StopDrawing()
EndIf
Dep = 8
Repeat
ClearScreen(0,155,255)
DisplaySprite(1000, x, 100)
x + Dep
If x >=300 Or x <=0 : Dep = -Dep : EndIf
FlipBuffers()
Until WindowEvent()=#PB_Event_CloseWindow
EndIf