Scrollarea doesn't scroll!

Just starting out? Need help? Post your questions and find answers here.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Scrollarea doesn't scroll!

Post by Trond »

Code: Select all

OpenWindow(0, 0, 0, 640, 480, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
CreateGadgetList(WindowID(0))
ScrollAreaGadget(0, 0, 0, 640, 480, 600, 800, 80)
ImageGadget(1, 0, 0, 600, 800, 0)
Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Break
  EndSelect
ForEver
Yes, I know it's an image there. How else am I supposed to be able to draw anything in there?

And an annoyance: when it does scroll, it does not follow the system settings on scroll speed.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Trond, I don't understand, it seems to scroll okay here.
I may look like a mule, but I'm not a complete ass.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

I forgot something vital: Try again with the scroll wheel on your mouse.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Sorry, I don't have a scroll wheel! (Laptop!)
I may look like a mule, but I'm not a complete ass.
sverson
Enthusiast
Enthusiast
Posts: 286
Joined: Sun Jul 04, 2004 12:15 pm
Location: Germany

...now it scrolls...

Post by sverson »

...now it scrolls... THX to Danilo 8)

Code: Select all

;/ sverson 2006

#WM_MOUSEWHEEL = $20A 
Procedure.w MouseWheelDelta() 
  ; German forum: http://robsite.de/php/pureboard/viewtopic.php?t=2289&postdays=0&postorder=asc&start=10
  ; Author: Danilo
  ; Date: 14. September 2003
  ;CodeArchiv: CheckMouseWheel.pb
  x.w = ((EventwParam()>>16)&$FFFF) 
  Debug x
  ProcedureReturn -(x / 120) 
EndProcedure 


Global Wheelstep.l=10


OpenWindow(0, 0, 0, 640, 480, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
CreateGadgetList(WindowID(0))
ScrollAreaGadget(0, 0, 0, 640, 480, 600, 800, 80)
ImageGadget(1, 0, 0, 600, 800, 0)
Repeat
  Select WaitWindowEvent()
    Case #WM_MOUSEWHEEL
      SetGadgetAttribute(0,#PB_ScrollArea_Y,GetGadgetAttribute(0,#PB_ScrollArea_Y)+(MouseWheelDelta()*Wheelstep))
    Case #PB_Event_CloseWindow
      Break
  EndSelect
ForEver
;-) sverson
User avatar
utopiomania
Addict
Addict
Posts: 1655
Joined: Tue May 10, 2005 10:00 pm
Location: Norway

Post by utopiomania »

It scrolls if you focus it?

Code: Select all

SetActiveGadget(1)
Repeat 
.
.
sverson
Enthusiast
Enthusiast
Posts: 286
Joined: Sun Jul 04, 2004 12:15 pm
Location: Germany

Post by sverson »

@utopiomania: works! - THX!
utopiomania wrote:It scrolls if you focus it?

Code: Select all

SetActiveGadget(1)
Repeat 
here some updated code to scroll X or Y...

Code: Select all

;/ sverson 2006
;/ ScrollArea MouseWheel.pb

#WM_MOUSEWHEEL = $20A 
#WM_MBUTTONUP = $208

Procedure.w MouseWheelDelta() 
  ; German forum: http://robsite.de/php/pureboard/viewtopic.php?t=2289&postdays=0&postorder=asc&start=10
  ; Author: Danilo
  ; Date: 14. September 2003
  ; CodeArchiv: CheckMouseWheel.pb
  x.w = ((EventwParam()>>16)&$FFFF) 
  Debug x
  ProcedureReturn -(x / 120) 
EndProcedure 

Procedure.l GadgetUnderCursor()
  Protected WinPoint.POINT
  GetCursorPos_(@WinPoint)
  ProcedureReturn WindowFromPoint_(WinPoint\x,WinPoint\y)
EndProcedure

Global Wheelstep.l=10
Global HorVer.b=1


OpenWindow(0, 0, 0, 640, 480, "click MouseWheel (MButton) to switch X/Y scroll", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
CreateGadgetList(WindowID(0))
ScrollAreaGadget(0, 0, 0, 640, 480, 800, 800, 80)
ImageGadget(1, 0, 0, 800, 800, 0)
Repeat
  Select WaitWindowEvent()
    Case #WM_MOUSEWHEEL
      If GadgetUnderCursor()=GadgetID(1)
        If HorVer
          SetGadgetAttribute(0,#PB_ScrollArea_Y,GetGadgetAttribute(0,#PB_ScrollArea_Y)+(MouseWheelDelta()*Wheelstep))
        Else
          SetGadgetAttribute(0,#PB_ScrollArea_X,GetGadgetAttribute(0,#PB_ScrollArea_X)+(MouseWheelDelta()*Wheelstep)) 
        EndIf
      EndIf
    Case #WM_MBUTTONUP
      HorVer=HorVer!1
    Case #PB_Event_CloseWindow
      Break
  EndSelect
ForEver
;-) sverson
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Thanks.
Post Reply