It is currently Fri Jul 10, 2020 9:44 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Trackpad-Scrolling inside a ScrollArea with Canvas dont work
PostPosted: Sat May 17, 2014 1:53 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Jun 11, 2004 7:07 am
Posts: 635
move cursor outside the canvas and scroll - work
move cursor inside the canvas and try to scroll - don't work

Scrolling inside a "ScrollArea" should work in every cases. Or there some events to handle this?

Code:
 If OpenWindow(0, 0, 0, 700, 400, "ScrollAreaGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    ScrollAreaGadget(0, 10, 10, 680, 380, 1000, 1000, 30)
      ButtonGadget  (1, 10, 10, 230, 30,"Button 1")
      ButtonGadget  (2, 50, 50, 230, 30,"Button 2")
      ButtonGadget  (3, 90, 90, 230, 30,"Button 3")
      CanvasGadget  (5, 200, 200, 500, 500)
      CloseGadgetList()
    StartDrawing(CanvasOutput(5))
    Box(0,0,500,500,$FF0000)
    StopDrawing()
    Repeat
      Select WaitWindowEvent()
        Case  #PB_Event_CloseWindow
          End
        Case  #PB_Event_Gadget
          Select EventGadget()
            Case 1
              MessageRequester("Info","Button 1 was pressed!",#PB_MessageRequester_Ok)
            Case 2
              MessageRequester("Info","Button 2 was pressed!",#PB_MessageRequester_Ok)
            Case 3
              MessageRequester("Info","Button 3 was pressed!",#PB_MessageRequester_Ok)
          EndSelect
      EndSelect
    ForEver
  EndIf


Top
 Profile  
Reply with quote  
 Post subject: Re: Trackpad-Scrolling inside a ScrollArea with Canvas dont
PostPosted: Sat May 17, 2014 9:54 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 2542
Location: Germany
the CanvasGadget has except for Windows automatically focus. See Canvas help.

Solution:
Code:
If OpenWindow(0, 0, 0, 700, 400, "ScrollAreaGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    ScrollAreaGadget(0, 10, 10, 680, 380, 1000, 1000, 30)
      ButtonGadget  (1, 10, 10, 230, 30,"Button 1")
      ButtonGadget  (2, 50, 50, 230, 30,"Button 2")
      ButtonGadget  (3, 90, 90, 230, 30,"Button 3")
      CanvasGadget  (5, 200, 200, 500, 500)
      CloseGadgetList()
    StartDrawing(CanvasOutput(5))
    Box(0,0,500,500,$FF0000)
    StopDrawing()
    Repeat
      Select WaitWindowEvent()
        Case  #PB_Event_CloseWindow
          End
        Case  #PB_Event_Gadget
          Select EventGadget()
            Case 1
              MessageRequester("Info","Button 1 was pressed!",#PB_MessageRequester_Ok)
            Case 2
              MessageRequester("Info","Button 2 was pressed!",#PB_MessageRequester_Ok)
            Case 3
              MessageRequester("Info","Button 3 was pressed!",#PB_MessageRequester_Ok)
            Case 5
              If EventType() = #PB_EventType_MouseWheel
                wheel = GetGadgetAttribute(5, #PB_Canvas_WheelDelta)
                SetGadgetAttribute(0, #PB_ScrollArea_Y, GetGadgetAttribute(0, #PB_ScrollArea_Y) - wheel * 3)
              EndIf
             
          EndSelect
      EndSelect
    ForEver
  EndIf

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: Trackpad-Scrolling inside a ScrollArea with Canvas dont
PostPosted: Sat May 17, 2014 11:11 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 8:26 am
Posts: 2991
Location: Planet Earth
What about left-right scrolling / left-right wipe? There is no event to support that, and
#PB_Canvas_WheelDelta gives only values for up-down scrolling / up-down wiping gesture.

Within the ScrollArea, left-right scrolling/wiping works fine.

EDIT:
#PB_EventType_MouseWheel event fires also for left-right scrolling/wiping, but
#PB_Canvas_WheelDelta is always 0.


Top
 Profile  
Reply with quote  
 Post subject: Re: Trackpad-Scrolling inside a ScrollArea with Canvas dont
PostPosted: Sun May 18, 2014 12:15 am 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 8:26 am
Posts: 2991
Location: Planet Earth
Danilo wrote:
What about left-right scrolling / left-right wipe?

- CanvasGadget GetWheelDeltaX() + GetWheelDeltaY()


Top
 Profile  
Reply with quote  
 Post subject: Re: Trackpad-Scrolling inside a ScrollArea with Canvas dont
PostPosted: Mon Sep 21, 2015 2:51 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 14065
Location: France
It's the intended behaviour (all mouse event in the canvas have the priority. We could still add a flag like '#PB_Canavas_DisableWheel' to allow this easily.


Top
 Profile  
Reply with quote  
 Post subject: Re: Trackpad-Scrolling inside a ScrollArea with Canvas dont
PostPosted: Thu Feb 21, 2019 9:50 am 
Offline
Addict
Addict

Joined: Fri Aug 28, 2015 6:10 pm
Posts: 1099
Location: Portugal
Hi all

Just a little confused.

Ran the example above and found the scrolling does not accur until the scrollarea gadget is clicked.

Looked like the canvas gadget did the scrolling so experimented by taking out the canvas gadget. Same again.

here is the code
Code:
If OpenWindow(0, 0, 0, 700, 400, "ScrollAreaGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    ScrollAreaGadget(0, 10, 10, 680, 380, 1000, 1000, 30)
      ButtonGadget  (1, 10, 10, 230, 30,"Button 1")
      ButtonGadget  (2, 50, 50, 230, 30,"Button 2")
      ButtonGadget  (3, 90, 90, 230, 30,"Button 3")
      CloseGadgetList()
   
    Repeat
      Select WaitWindowEvent()
        Case  #PB_Event_CloseWindow
          End
        Case  #PB_Event_Gadget
          Select EventGadget()

            Case 1
              MessageRequester("Info","Button 1 was pressed!",#PB_MessageRequester_Ok)
            Case 2
              MessageRequester("Info","Button 2 was pressed!",#PB_MessageRequester_Ok)
            Case 3
              MessageRequester("Info","Button 3 was pressed!",#PB_MessageRequester_Ok)

          EndSelect
      EndSelect
    ForEver
  EndIf


How can I get the scroll area gadget to scroll on mousewheel without clicling so just mouse over?

cross platform please.

regards

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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Trackpad-Scrolling inside a ScrollArea with Canvas dont
PostPosted: Thu Feb 21, 2019 10:04 am 
Offline
Addict
Addict

Joined: Fri Aug 28, 2015 6:10 pm
Posts: 1099
Location: Portugal
Reading more think it can be done.

Added

Code:
TextGadget(4,10,140,100,40,"")
HideGadget(4,#True)


Just after last button gadget then

SetActiveGadget(4)

After closegadgetlist()

Works First time even with a canvasgadget added again.

_________________
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye