Detect mouse wheel in events for listicongadget

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
marcoagpinto
Addict
Addict
Posts: 1045
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

Detect mouse wheel in events for listicongadget

Post by marcoagpinto »

As you all know, I have been working hard on several projects such as my tool "Proofing Tool GUI" in the part that edits the Hunspell dictionaries:
http://marcoagpinto.cidadevirtual.pt/pr ... olgui.html

Due to the fact that in Linux there was a huge pause while loadings 10 000s of words into a listicongadget, I have done like people suggested in the forums and only show 11 entries at the time and created a vertical scroll bar to simulate the real one.

I have been able to simulate just about everything, except the mouse wheel.

For example, to check if the cursor key was pressed, I have:

Code: Select all

AddKeyboardShortcut(#WINDOW_MAIN,#PB_Shortcut_Up,1004)
And then the code that handles it:

Code: Select all

    ; USE CURSOR KEY UP TO SCROLL IN THE LISTICONGADGET OF THE DICTIONARY
    If event=#PB_Event_Menu And EventMenu()=1004  And GetActiveGadget()=#PANEL_BOX_WORDS And selected_dictionary_word<>-1       
      t=GetGadgetState(#PANEL_BOX_WORDS)
      t1=GetGadgetState(#PANEL_BOX_WORDS_VERTICAL_BAR)
      Debug "CURSOR UP pressed!"
      
      ; word not visible - 27/MAR/2014
      If t=-1
        t1=selected_dictionary_word-1
        If t1=0
          t1=1
          selected_dictionary_word=1
        Else
          selected_dictionary_word-1
          t1+1
        EndIf
        SetGadgetState(#PANEL_BOX_WORDS_VERTICAL_BAR,t1)        
        t=t1-GetGadgetState(#PANEL_BOX_WORDS_VERTICAL_BAR)
        SetGadgetState(#PANEL_BOX_WORDS,t)        
        update_vertical_scroll_bar_dictionary()
      EndIf 
      
      If t=0 And t1>0
        SetGadgetState(#PANEL_BOX_WORDS_VERTICAL_BAR,t1-1)
        update_vertical_scroll_bar_dictionary()
      EndIf
      
      If t=0 : t=1 : EndIf ; To fix the following line of code
      SetGadgetState(#PANEL_BOX_WORDS,t-1)
      
      ; 5-MAR-2014 - Attempt to always show highlighted item in words
      t=GetGadgetState(#PANEL_BOX_WORDS)
      t1=GetGadgetState(#PANEL_BOX_WORDS_VERTICAL_BAR)
      selected_dictionary_word=t1+t      
      
    EndIf    

But there is no correspondent for mouse wheel.

Is there a way Freddy could add it?

Thanks!

Kind regards from the one who loves you all,
>Marco A.G.Pinto
---------------