Page 1 of 2
ScrollAreaGadget Not Scrolling
Posted: Sat Aug 15, 2015 9:26 pm
by DirkVW
I cannot get the following code to scroll at all in an 800x600 Window:
Code: Select all
SC = ScrollAreaGadget(#PB_Any,0,50,800,510,1000,600)
GraphicSchedule = CanvasGadget(#PB_Any,0,0,1000,600)
CloseGadgetList()
I can draw to the CanvasGadget, which is larger than the windows width, which is why I need to scroll. Any details are appreciated!
When I run the above code, the events I have on later lines drawn to the canvas on the output window can be seen, but only in the box 800 x 510 but that the scroll area gadget is allowing to show---and it will not scroll to other areas of the CanvasGadget. It looks like an incomplete picture in the window.
Re: ScrollAreaGadget Not Scrolling
Posted: Sat Aug 15, 2015 9:51 pm
by infratec
When I run this code, I see nothing.
Please provide a full working code which shows the behaviour.
Bernd
Re: ScrollAreaGadget Not Scrolling
Posted: Sat Aug 15, 2015 9:55 pm
by infratec
A working example:
Code: Select all
If OpenWindow(0, 0, 0, 220, 220, "CanvasGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ScrollAreaGadget(1,10,10,200,200,1000,1000)
CanvasGadget(0, 0, 0, 1000, 1000)
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget And EventGadget() = 0
If EventType() = #PB_EventType_LeftButtonDown Or (EventType() = #PB_EventType_MouseMove And GetGadgetAttribute(0, #PB_Canvas_Buttons) & #PB_Canvas_LeftButton)
If StartDrawing(CanvasOutput(0))
x = GetGadgetAttribute(0, #PB_Canvas_MouseX)
y = GetGadgetAttribute(0, #PB_Canvas_MouseY)
Circle(x, y, 10, RGB(Random(255), Random(255), Random(255)))
StopDrawing()
EndIf
EndIf
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
Bernd
Re: ScrollAreaGadget Not Scrolling
Posted: Sat Aug 15, 2015 10:09 pm
by netmaestro
Using your code untouched and adding just enough lines to make a working program, here's an example showing that it does scroll out to the sides and bottom until all numbers can be seen:
Code: Select all
CreateImage(0, 1000, 600, 24, #White)
StartDrawing(ImageOutput(0))
DrawText(0,0,"1",#Black,#White)
DrawText(495,0,"2",#Black,#White)
DrawText(990,0,"3",#Black,#White)
DrawText(0,290,"4",#Black,#White)
DrawText(495,290,"5",#Black,#White)
DrawText(990,290,"6",#Black,#White)
DrawText(0,586,"7",#Black,#White)
DrawText(495,586,"8",#Black,#White)
DrawText(990,586,"9",#Black,#White)
StopDrawing()
OpenWindow(0,0,0,1024,768,"",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
SC = ScrollAreaGadget(#PB_Any,0,50,800,510,1000,600)
GraphicSchedule = CanvasGadget(#PB_Any,0,0,1000,600)
CloseGadgetList()
SetGadgetAttribute(GraphicSchedule, #PB_Canvas_Image, ImageID(0))
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
Re: ScrollAreaGadget Not Scrolling
Posted: Sat Aug 15, 2015 10:41 pm
by DirkVW
Thank you Bernd but your example does not work; in fact it exhibits the same behavior i notice i my program. In you example, I am able to draw to the CanvasGadget but I cannot scroll the ScrollAreaGadget at all. It acts just like a un-scrollable picture. Maybe something wrong with my settings?
Re: ScrollAreaGadget Not Scrolling
Posted: Sat Aug 15, 2015 11:15 pm
by infratec
Hi,
then we need more informations like:
OS, PB version
Here it works with Win7 64bit and PB 5.31 x86
But you see the sliders?
Bernd
Re: ScrollAreaGadget Not Scrolling
Posted: Sat Aug 15, 2015 11:39 pm
by DirkVW
Okay here is "working" example that won't work for me: I am using PureBasic 5.31 on Mac OSX (10.9.4).
I create an image, add a large circle to the image, then add it to the canvas, which is placed in a ScrollAreaGadget. Why won't it scroll?
Code: Select all
OpenWindow(0,0,0,800,600,"Test ScrollArea")
NewImage = CreateImage(#PB_Any,1000,1000,24,RGB(255,255,255))
StartDrawing(ImageOutput(NewImage))
Circle(200,200,300,RGB(255,0,0))
StopDrawing()
SC = ScrollAreaGadget(#PB_Any,50,50,700,500,1000,1000)
GraphicSchedule = CanvasGadget(#PB_Any,0,0,1000,1000)
CloseGadgetList()
SetGadgetAttribute(GraphicSchedule, #PB_Canvas_Image, ImageID(NewImage))
Repeat:Until WaitWindowEvent() = #PB_Event_CloseWindow
Also: Yes I see the sliders, but I am on a Mac so the sliders automatically disappear after a second or so.
Re: ScrollAreaGadget Not Scrolling
Posted: Sun Aug 16, 2015 12:28 am
by netmaestro
The sample I posted works perfectly on Windows. If it isn't working on MacOS then submit my code (tested working on Windows) to the MacOS bug reports because it should work there too.
Re: ScrollAreaGadget Not Scrolling
Posted: Sun Aug 16, 2015 9:42 am
by davido
Scrolls and looks exactly the same on PC with windows 7 and MacBook Pro with OSX 10.10.4
Re: ScrollAreaGadget Not Scrolling
Posted: Thu Jun 30, 2016 5:19 am
by Lebostein
Same problem here with Mac OS!!
You can not scroll with the trackpad if you are inside the scroll area with mouse cursor!
It seems the scrolling is disabled with a canvas gadget. With an image gadget it works as expected!
Trackpad scrolling don't work (canvas gadget):
Code: Select all
OpenWindow(0,0,0,800,600,"Test ScrollArea")
NewImage = CreateImage(#PB_Any,1000,1000,24,RGB(255,255,255))
StartDrawing(ImageOutput(NewImage))
Circle(200,200,300,RGB(255,0,0))
StopDrawing()
SC = ScrollAreaGadget(#PB_Any,50,50,700,500,1000,1000)
GraphicSchedule = CanvasGadget(#PB_Any,0,0,1000,1000)
CloseGadgetList()
SetGadgetAttribute(GraphicSchedule, #PB_Canvas_Image, ImageID(NewImage))
Repeat:Until WaitWindowEvent() = #PB_Event_CloseWindow
Trackpad scrolling works (image gadget):
Code: Select all
OpenWindow(0,0,0,800,600,"Test ScrollArea")
NewImage = CreateImage(#PB_Any,1000,1000,24,RGB(255,255,255))
StartDrawing(ImageOutput(NewImage))
Circle(200,200,300,RGB(255,0,0))
StopDrawing()
SC = ScrollAreaGadget(#PB_Any,50,50,700,500,1000,1000)
GraphicSchedule = ImageGadget(#PB_Any,0,0,1000,1000, ImageID(NewImage))
CloseGadgetList()
Repeat:Until WaitWindowEvent() = #PB_Event_CloseWindow
Re: ScrollAreaGadget Not Scrolling
Posted: Thu Jun 30, 2016 6:02 am
by netmaestro
Try with #PB_Canvas_Keyboard just for fun.
Re: ScrollAreaGadget Not Scrolling
Posted: Thu Jun 30, 2016 8:41 am
by Lebostein
netmaestro wrote:Try with #PB_Canvas_Keyboard just for fun.
Sorry, don't work. I think the problem are the special Event Types of this gadget: EventType_MouseMove and EventType_MouseWheel. It could be that this events blocks the scrolling? But how I catch these events and how I execute the scrolling nevertheless?
Re: ScrollAreaGadget Not Scrolling
Posted: Thu Jun 30, 2016 11:46 am
by Lebostein
millahjovich wrote:When I run this code, I see nothing.
Please provide a full working code which shows the behaviour.
Bernd
@Bernd (or should I say Alan, infratec or millahjovich, I don't know): you have post your "Please provide a full working code" twice in this thread....
Sometimes it is not enough to read the first post. There are enough working snippets in this thread. One snippet is from you

Re: ScrollAreaGadget Not Scrolling
Posted: Thu Jun 30, 2016 2:29 pm
by kenmo
@Lebostein Millah seems to be the latest of the bots which duplicate posts in random topics.
Re: ScrollAreaGadget Not Scrolling
Posted: Sat Sep 07, 2019 8:48 am
by collectordave
Old thread I know.
Having similar problem.
When mouse over canvas gadget in scroll area gadget no scrolling.
I am using PB5.7 on a mac.
Trying the code above.
Was this ever resolved?
CD