It is currently Fri Aug 14, 2020 9:48 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 35 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Keyboard shortcuts for mouse wheel
PostPosted: Wed Jan 03, 2018 7:19 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 693
Location: Portugal
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!


Top
 Profile  
Reply with quote  
 Post subject: Re: Keyboard shortcuts for mouse wheel
PostPosted: Thu Jan 04, 2018 12:06 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Oct 09, 2007 2:15 am
Posts: 1131
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 ;)

_________________
PureBasic 5.72 LTS (Windows x86/x64) | Windows10 Pro x64 | Z370 Extreme4 | i7 8770k | 32GB RAM | iChill GeForce RTX 2080 Super | HAF XF Evo​​
English is not my native language... (I often use DeepL to translate my texts.)


Top
 Profile  
Reply with quote  
 Post subject: Re: Keyboard shortcuts for mouse wheel
PostPosted: Fri Jan 05, 2018 2:42 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 693
Location: Portugal
Bisonte wrote:
Keyboard Shortcuts ?

or if you made a Listview by yourself.. you have to create such functionality ;)


How?


Top
 Profile  
Reply with quote  
 Post subject: Re: Keyboard shortcuts for mouse wheel
PostPosted: Fri Jan 05, 2018 12:55 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Oct 09, 2007 2:15 am
Posts: 1131
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 ;)

_________________
PureBasic 5.72 LTS (Windows x86/x64) | Windows10 Pro x64 | Z370 Extreme4 | i7 8770k | 32GB RAM | iChill GeForce RTX 2080 Super | HAF XF Evo​​
English is not my native language... (I often use DeepL to translate my texts.)


Top
 Profile  
Reply with quote  
 Post subject: Re: Keyboard shortcuts for mouse wheel
PostPosted: Sat Jan 06, 2018 8:51 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 693
Location: Portugal
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Keyboard shortcuts for mouse wheel
PostPosted: Sat Jan 06, 2018 9:00 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 693
Location: Portugal
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Keyboard shortcuts for mouse wheel
PostPosted: Sat Jan 06, 2018 11:11 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Oct 09, 2007 2:15 am
Posts: 1131
If it is a normal ListIconGadget, you can scroll the list with the cursor keys (on windows) if it has the focus....

_________________
PureBasic 5.72 LTS (Windows x86/x64) | Windows10 Pro x64 | Z370 Extreme4 | i7 8770k | 32GB RAM | iChill GeForce RTX 2080 Super | HAF XF Evo​​
English is not my native language... (I often use DeepL to translate my texts.)


Top
 Profile  
Reply with quote  
 Post subject: Re: Keyboard shortcuts for mouse wheel
PostPosted: Sun Jan 07, 2018 11:27 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 693
Location: Portugal
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Keyboard shortcuts for mouse wheel
PostPosted: Mon Jan 08, 2018 9:49 am 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1907
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:
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


Top
 Profile  
Reply with quote  
 Post subject: Re: Keyboard shortcuts for mouse wheel
PostPosted: Mon Jan 08, 2018 10:57 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 693
Location: Portugal
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:
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).

Image

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!


Top
 Profile  
Reply with quote  
 Post subject: Re: Keyboard shortcuts for mouse wheel
PostPosted: Mon Jan 08, 2018 11:19 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 693
Location: Portugal
@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!


Top
 Profile  
Reply with quote  
 Post subject: Re: Keyboard shortcuts for mouse wheel
PostPosted: Mon Jan 08, 2018 11:55 am 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1907
I don't use Linux or Mac, so I can't help further, sorry. :(


Top
 Profile  
Reply with quote  
 Post subject: Re: Keyboard shortcuts for mouse wheel
PostPosted: Mon Jan 08, 2018 10:21 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 19, 2011 3:47 am
Posts: 2314
Location: Singapore
Take a look at this:

> Virtual Scroll

_________________
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too!


Top
 Profile  
Reply with quote  
 Post subject: Re: Keyboard shortcuts for mouse wheel
PostPosted: Tue Jan 09, 2018 12:36 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 693
Location: Portugal
Now seriously,

Look at the help for the ScroolBarGadget():
Code:
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!


Top
 Profile  
Reply with quote  
 Post subject: Re: Keyboard shortcuts for mouse wheel
PostPosted: Sun Nov 17, 2019 10:41 am 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1907
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?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 35 posts ]  Go to page 1, 2, 3  Next

All times are UTC + 1 hour


Who is online

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