Disable mouse wheel action on combobox?

Just starting out? Need help? Post your questions and find answers here.
ozzie
Enthusiast
Enthusiast
Posts: 429
Joined: Sun Apr 06, 2008 12:54 pm
Location: Brisbane, Qld, Australia
Contact:

Disable mouse wheel action on combobox?

Post by ozzie »

Is there a way to prevent the mouse wheel changing the selected entry in a combobox? Even knowing that the mouse wheel was used to trigger the 'change' event would be helpful.
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Disable mouse wheel action on combobox?

Post by RSBasic »

Code: Select all

EnableExplicit

Define a
Global ComboBoxCB

Procedure ComboBoxCB(hWnd, Message, wParam, lParam)
  Select Message
    Case #WM_MOUSEWHEEL
      ProcedureReturn 1
  EndSelect
  
  ProcedureReturn CallWindowProc_(ComboBoxCB, hWnd, Message, wParam, lParam)
EndProcedure

If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ComboBoxGadget(1, 10, 10, 200, 20, 0)
 
  For a=1 To 25
    AddGadgetItem(1, -1, "Item " + Str(a), 0, 0)
  Next
  
  ComboBoxCB = SetWindowLongPtr_(GadgetID(1), #GWL_WNDPROC, @ComboBoxCB())
  
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        End
    EndSelect
  ForEver
EndIf
Image
Image
ozzie
Enthusiast
Enthusiast
Posts: 429
Joined: Sun Apr 06, 2008 12:54 pm
Location: Brisbane, Qld, Australia
Contact:

Re: Disable mouse wheel action on combobox?

Post by ozzie »

Brilliant! Many thanks for the prompt response.
Post Reply