Page 1 of 1

Disable Mouse Wheel on combobox controls

Posted: Tue Apr 07, 2015 5:33 pm
by don lowenstein
How can I "turn off" the wheel of the mouse in a combo-box?

My problem is, if focus is on a combo-box and the user wishes to scroll a dialog, the combobox values change by default, in stead of the dialog scrolling with the mouse wheel as it does with control on a different type of control.

Re: Disable Mouse Wheel on combobox controls

Posted: Tue Apr 07, 2015 5:41 pm
by Antonio Linares
Don,

Please try this and let me know if the combobox keeps scrolling, thanks

oComboBox:bMouseWheel = { || call_to_your_dialog_scroll_code }

Re: Disable Mouse Wheel on combobox controls

Posted: Tue Apr 07, 2015 5:58 pm
by don lowenstein
I've tried this in my DEFAULT Method for this class. The value does in fact scroll, after going thru my logic. Somewhere the event is handled at a Super: level after control goes thru this method.

**************************************************
//----------------------------------------------------------------------------//

METHOD Default() CLASS TDComboBox

Local cStart
::bmousewheel := { | | ::ComboWheel() }

...
more lines of code from your Default Method
...

RETURN NIL



*******************************************************************

METHOD ComboWheel() CLASS TDComboBox
LOCAL RETVAL, X

altd( )

RETURN NIL

*************************************************

the mouse wheel goes thru this function, but, it is

Re: Disable Mouse Wheel on combobox controls

Posted: Tue Apr 07, 2015 6:09 pm
by Antonio Linares
Don,

Please try this,

oComboBox:bMouseWheel = { || call_to_your_dialog_scroll_code, 0 }

Re: Disable Mouse Wheel on combobox controls

Posted: Tue Apr 07, 2015 8:21 pm
by don lowenstein
Your suggestion did in fact disable the scroll on the ComboBox.

My goal was to scroll the dialog (when it did not all fit on the screen) with the mouse wheel. In order to re-direct the mousewheel event to the dialog my combo-box scroll method looks like below. This works great.


METHOD ComboWheel( nKeys, nDelta, nXPos, nYPos) CLASS TDComboBox

LOCAL RETVAL, X
LOCAL ODLG := SELF:OWND

RETVAL := EVAL( ODLG:BMOUSEWHEEL, nKeys, nDelta, nXPos, nYPos )

RETURN RETVAL

Re: Disable Mouse Wheel on combobox controls

Posted: Tue Apr 07, 2015 8:24 pm
by Antonio Linares
Very good :-)