It is currently Sat Jan 16, 2021 7:42 am

All times are UTC + 1 hour

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: PB 5.72 LTS - Mac Shift key + mouse wheeel canvas issue
PostPosted: Tue Nov 17, 2020 12:09 am 

Joined: Thu Oct 22, 2020 7:01 am
Posts: 21
Hi, I m working on a program that requires a canvasgadget inside a scroll area gadget and I discovered that if you place the mouse over the canvas gadget the scroll area ignores the mousehweel so you need to make a work around in order to scroll the scroll area with the mouse wheel by using a code like this

Procedure moveChipset()
  SetGadgetAttribute(#chipsetArea,#PB_ScrollArea_Y,GetGadgetAttribute(#chipsetArea,#PB_ScrollArea_Y)-GetGadgetAttribute(#chipsetCanvas, #PB_Canvas_WheelDelta))


You can see the whole code on the initial post

This workaround helps. to fix the issue with the vertical scrolling. The problem comes when you have a scroll area that also needs to be scrolled horizontally as it looks the mousewheel delta detects 0 when you tap the shift key at the same time, so there is no way to tell the program that im trying to scroll horizontally as the mousewheeldelta returns 0

Is there any workaround to this issue? or am I missing any event that returns the horizontal mousewheel in a mac?

Many thanks

Edit: I found a workaround based on the code of @wilbert here ... 332b85ccb3

What i did is the following

#NSScrollWheel        = 22

Global sharedApplication = CocoaMessage(0, 0, "NSApplication sharedApplication")
Define currentEvent, type, modifierFlags, keyCode
Define deltaX.CGFloat, deltaY.CGFloat

Procedure moveMap()
  Shared currentEvent, type, deltaX, deltaY, sharedApplication
  currentEvent = CocoaMessage(0, sharedApplication, "currentEvent")
  type = CocoaMessage(0, currentEvent, "type")
  If currentEvent
    type = CocoaMessage(0, currentEvent, "type")
    If type = #NSScrollWheel
      CocoaMessage(@deltaX, currentEvent, "deltaX")
      CocoaMessage(@deltaY, currentEvent, "deltaY")
      Debug "Mouse wheel delta (" + StrF(deltaX, 1) + "," + StrF(deltaY, 1) + ")"


But there are a couple of things i dont like about this solution
- First; it doesnt feel that smooth as my solution for the vertical scrolling, the scroll is done slower but im afraid this would be different per computer so i wont change it. (maybe im wrong) (if I multiply it x4 it works very similar to the default scrollareagadget but i donno what are the implications of doing this)
- Second: This cocoa codes feels like dark magic to me, im not sure exactly what im doing..
- Third: It wont be a multiplatform solution as cocoa is mac only (but maybe in windows this issue doesnt happen I didnt research enought and my workstation is a mac)

Any thoughts?

Reply with quote  
 Post subject: Re: PB 5.72 LTS - Mac Shift key + mouse wheeel canvas issue
PostPosted: Fri Nov 20, 2020 5:36 am 

Joined: Fri Aug 28, 2015 6:10 pm
Posts: 1181
Location: Portugal
Sounds a little like a problem I was having.

Scrolling a canvas gadget platform.

I produced a solution where the canvas gadget was inside a container. You can see the code here

Do not know whether it will help.


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.

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

All times are UTC + 1 hour

Who is online

Users browsing this forum: No registered users and 14 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