ScrollAreaGadget Not Scrolling

Just starting out? Need help? Post your questions and find answers here.
DirkVW
New User
New User
Posts: 5
Joined: Sun May 31, 2015 9:08 pm

ScrollAreaGadget Not Scrolling

Post 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.
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: ScrollAreaGadget Not Scrolling

Post by infratec »

When I run this code, I see nothing.

Please provide a full working code which shows the behaviour.

Bernd
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: ScrollAreaGadget Not Scrolling

Post 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
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: ScrollAreaGadget Not Scrolling

Post 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
BERESHEIT
DirkVW
New User
New User
Posts: 5
Joined: Sun May 31, 2015 9:08 pm

Re: ScrollAreaGadget Not Scrolling

Post 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?
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: ScrollAreaGadget Not Scrolling

Post 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
DirkVW
New User
New User
Posts: 5
Joined: Sun May 31, 2015 9:08 pm

Re: ScrollAreaGadget Not Scrolling

Post 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.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: ScrollAreaGadget Not Scrolling

Post 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.
BERESHEIT
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: ScrollAreaGadget Not Scrolling

Post by davido »

Scrolls and looks exactly the same on PC with windows 7 and MacBook Pro with OSX 10.10.4
DE AA EB
Lebostein
Addict
Addict
Posts: 833
Joined: Fri Jun 11, 2004 7:07 am

Re: ScrollAreaGadget Not Scrolling

Post 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
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: ScrollAreaGadget Not Scrolling

Post by netmaestro »

Try with #PB_Canvas_Keyboard just for fun.
BERESHEIT
Lebostein
Addict
Addict
Posts: 833
Joined: Fri Jun 11, 2004 7:07 am

Re: ScrollAreaGadget Not Scrolling

Post 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?
Lebostein
Addict
Addict
Posts: 833
Joined: Fri Jun 11, 2004 7:07 am

Re: ScrollAreaGadget Not Scrolling

Post 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 :wink:
User avatar
kenmo
Addict
Addict
Posts: 2054
Joined: Tue Dec 23, 2003 3:54 am

Re: ScrollAreaGadget Not Scrolling

Post by kenmo »

@Lebostein Millah seems to be the latest of the bots which duplicate posts in random topics.
collectordave
Addict
Addict
Posts: 1310
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: ScrollAreaGadget Not Scrolling

Post 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
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
Post Reply