Page 1 of 3
Keyboard shortcuts for mouse wheel
Posted: Wed Jan 03, 2018 7:19 pm
by marcoagpinto
Hello Fred,
Could you add two new types of keyboard shortcuts regarding if one scrolls the mouse wheel up or down?
#PB_Shortcut_MouseWheel_Up
#PB_Shortcut_MouseWheel_Down
?
Or something like that?
It would be very useful if one uses virtual ListIconGadgets, since I have been asking for help regarding them and no one seems to give a solution to the problem.
Thanks!
Re: Keyboard shortcuts for mouse wheel
Posted: Thu Jan 04, 2018 12:06 pm
by Bisonte
Keyboard Shortcuts ?
I think you mean EventTypes....
But normally, you can scroll in a Listview with the Cursor up&down keys....
or if you made a Listview by yourself.. you have to create such functionality

Re: Keyboard shortcuts for mouse wheel
Posted: Fri Jan 05, 2018 2:42 am
by marcoagpinto
Bisonte wrote:Keyboard Shortcuts ?
or if you made a Listview by yourself.. you have to create such functionality

How?
Re: Keyboard shortcuts for mouse wheel
Posted: Fri Jan 05, 2018 12:55 pm
by Bisonte
This depends on how you created the ListView.
If you show the complete code of your ListView, there is probably
someone who can implement this function. Maybe even me

Re: Keyboard shortcuts for mouse wheel
Posted: Sat Jan 06, 2018 8:51 pm
by marcoagpinto
Bisonte wrote:This depends on how you created the ListView.
If you show the complete code of your ListView, there is probably
someone who can implement this function. Maybe even me

It is a ListIconGadget, not a ListView.
Re: Keyboard shortcuts for mouse wheel
Posted: Sat Jan 06, 2018 9:00 pm
by marcoagpinto
Anyway, the project is open-source.
You can download the source from its official page:
http://proofingtoolgui.org
However, I am currently working on build 120 which will be release after Fred updates PB 5.61 since there are issues with Ubuntu 17.10.
On build 120 I have been cleaning the code to make everything look better.
Re: Keyboard shortcuts for mouse wheel
Posted: Sat Jan 06, 2018 11:11 pm
by Bisonte
If it is a normal ListIconGadget, you can scroll the list with the cursor keys (on windows) if it has the focus....
Re: Keyboard shortcuts for mouse wheel
Posted: Sun Jan 07, 2018 11:27 pm
by marcoagpinto
Bisonte wrote:If it is a normal ListIconGadget, you can scroll the list with the cursor keys (on windows) if it has the focus....
It is not a normal ListIconGadget as I download the lines into an array, and only show 13 at a time (customisable).
I had to code by hand the curs up/down.
Re: Keyboard shortcuts for mouse wheel
Posted: Mon Jan 08, 2018 9:49 am
by Dude
marcoagpinto wrote:Could you add two new types of keyboard shortcuts regarding if one scrolls the mouse wheel up or down?
Marco, is this what you want? (Windows only).
Code: Select all
If OpenWindow(0,300,300,400,200,"MouseWheel",#PB_Window_SystemMenu)
TextGadget(0,20,20,200,20,"Scroll the mouse wheel...")
Repeat
ev=WaitWindowEvent()
If ev=#WM_MOUSEWHEEL
If EventwParam()>0
SetGadgetText(0,"UP")
ElseIf EventwParam()<0
SetGadgetText(0,"DOWN")
EndIf
EndIf
Until ev=#PB_Event_CloseWindow
EndIf
Re: Keyboard shortcuts for mouse wheel
Posted: Mon Jan 08, 2018 10:57 am
by marcoagpinto
Dude wrote:marcoagpinto wrote:Could you add two new types of keyboard shortcuts regarding if one scrolls the mouse wheel up or down?
Marco, is this what you want? (Windows only).
Code: Select all
If OpenWindow(0,300,300,400,200,"MouseWheel",#PB_Window_SystemMenu)
TextGadget(0,20,20,200,20,"Scroll the mouse wheel...")
Repeat
ev=WaitWindowEvent()
If ev=#WM_MOUSEWHEEL
If EventwParam()>0
SetGadgetText(0,"UP")
ElseIf EventwParam()<0
SetGadgetText(0,"DOWN")
EndIf
EndIf
Until ev=#PB_Event_CloseWindow
EndIf
The idea looks good, but if one increases the bars, the ListIconGadget gets an horizontal scroll bar and the mouse wheel will scroll it (while showing 13 at a time).
Is there a way of using your code also on Linux and Mac and disabling the horizontal scroll bar from being affected by the mouse wheel?
Thank you!
Re: Keyboard shortcuts for mouse wheel
Posted: Mon Jan 08, 2018 11:19 am
by marcoagpinto
@Dude
Maybe, as a workaround, I could bind the mouse wheel scroll to the vertical scroll bar, so that when over it, it would scroll.
But, I still need to know how to get the wheel event to Linux and Mac.
Could you help?
Thank you, my friend!
Re: Keyboard shortcuts for mouse wheel
Posted: Mon Jan 08, 2018 11:55 am
by Dude
I don't use Linux or Mac, so I can't help further, sorry.

Re: Keyboard shortcuts for mouse wheel
Posted: Mon Jan 08, 2018 10:21 pm
by TI-994A
Take a look at this:
>
Virtual Scroll
Re: Keyboard shortcuts for mouse wheel
Posted: Tue Jan 09, 2018 12:36 am
by marcoagpinto
Now seriously,
Look at the help for the ScroolBarGadget():
Code: Select all
Example: ScrollBar events
Procedure BindHScrollDatas()
SetWindowTitle(0, "ScrollBarGadget (" + GetGadgetState(0) + ")" )
EndProcedure
Procedure BindVScrollDatas()
SetWindowTitle(0, "ScrollBarGadget (" + GetGadgetState(1) + ")" )
EndProcedure
If OpenWindow(0, 0, 0, 400, 400, "ScrollBarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
TextGadget (2, 10, 25, 350, 30, "ScrollBar Standard (start = 50, page = 30/100)")
ScrollBarGadget (0, 10, 50, 350, 20, 0, 100, 30)
SetGadgetState (0, 50) ; set 1st scrollbar (ID = 0) to 50 of 100
TextGadget (3, 10, 120, 350, 30, "ScrollBar vertical (start = 100, page = 50/300)")
ScrollBarGadget (1, 175, 160, 25, 120 ,0, 300, 50, #PB_ScrollBar_Vertical)
SetGadgetState (1, 100) ; set 2nd scrollbar (ID = 1) to 100 of 300
BindGadgetEvent(0, @ BindHScrollDatas())
BindGadgetEvent(1, @ BindVScrollDatas())
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
End
Case #PB_Event_Gadget
Select EventGadget()
Case 0
MessageRequester("Info","The ScrollBar 0 has been used ! (" + GetGadgetState(0) +
")" ,#PB_MessageRequester_Ok)
Case 1
MessageRequester("Info","The ScrollBar 1 has been used ! (" + GetGadgetState(1) +
")" ,#PB_MessageRequester_Ok)
EndSelect
EndSelect
ForEver
EndIf
What is the point of this, if it doesn't allow scroll with the mouse wheel?
Fred, could you take it as a feature request?
Thank you!
Re: Keyboard shortcuts for mouse wheel
Posted: Sun Nov 17, 2019 10:41 am
by Dude
The code I posted above is no longer useful for 64bit PureBasic because it doesn't return negative or positive values for the wheel direction. Is there some sort of ">>" math trick to make it work again?