Page 1 of 1

Disable mouse wheel in FWH 8.10

PostPosted: Wed Dec 03, 2008 12:47 am
by cdmmaui
How can I disable mouse wheel in FWH 8.10?

Thank You,

PostPosted: Wed Dec 03, 2008 1:19 am
by James Bott
Darrell,

I don't think you can. Why would you want to?

Regards,
James

PostPosted: Wed Dec 03, 2008 1:25 am
by Antonio Linares
Darrell,

In the class where you want to disable it, include this method:

METHOD MouseWheel( nKey, nDelta, nXPos, nYPos ) VIRTUAL

PostPosted: Wed Dec 03, 2008 1:29 am
by James Bott
Antonio,

That is a nice simple solution!

If I remember correctly there is a way in xHarbour to override a class method so you don't have to modify the original source. Can you show us how to do it that way?

Regards,
James

PostPosted: Wed Dec 03, 2008 1:42 am
by cdmmaui
Thank You Antonio and James,

Antonio, can you provide sample source per James' request?

PostPosted: Wed Dec 03, 2008 2:15 am
by Antonio Linares
I am not very much used to this syntax, but I guess this may work:

Code: Select all  Expand view
#include "FiveWin.ch"
...

OVERRIDE METHOD MouseWheel IN CLASS TXBrowse WITH MyMouseWheel

...

function MyMouseWheel( nKey, nDelta, nXPos, nYPos )

   // local Self := HB_QSelf()

return nil

PostPosted: Wed Dec 03, 2008 11:15 am
by Rossine
Hello Antonio,


Maybe you could create a "flag" to control this, ie one more appeal to xbrowse :lol:

SAMPLE:

Code: Select all  Expand view
//----------------------------------------------------------------------------//

STATIC FUNCTION BasicCell( oWnd )

   local oChild, oBrw

   DEFINE WINDOW oChild TITLE "Basic Cell selector browse" MDICHILD OF oWnd

   @ 0,0 XBROWSE oBrw OF oWnd ALIAS Alias()

   oBrw:CreateFromCode()

   oBrw:cToolTip = "This is a test"

   oBrw:lMouseWheel := .F.      // NEW

   oChild:oClient := oBrw

   ACTIVATE WINDOW oChild ON INIT oBrw:SetFocus()

RETURN NIL



Changes is XBROWSE.PRG

Code: Select all  Expand view
//----------------------------------------------------------------------------//


METHOD New( oWnd ) CLASS TXBrowse

...
::lMouseWheel := .T.
...

return Self

//----------------------------------------------------------------------------//

METHOD MouseWheel( nKeys, nDelta, nXPos, nYPos ) CLASS TXBrowse

   local aPoint := { nYPos, nXPos }

   if ! ::lMouseWheel
      return NIL
   endif

   ScreenToClient( ::hWnd, aPoint )

   if IsOverWnd( ::hWnd, aPoint[ 1 ], aPoint[ 2 ] ) .and. ;
...
return NIL

PostPosted: Wed Dec 03, 2008 12:45 pm
by James Bott
I still wonder why you want to disable the scroll wheel?

As a user, I would not be happy about this--I use it extensively.

Regards,
James

PostPosted: Wed Dec 03, 2008 4:11 pm
by cdmmaui
Hi James,

I am having a problem in which I call a modal dialog box from listbox window and the user is using the mouse wheel within the dialog to change the focus of the listbox record. I need to disable the mouse wheel only for this process.

PostPosted: Wed Dec 03, 2008 4:19 pm
by James Bott
Darrell,

>I am having a problem in which I call a modal dialog box from listbox window and the user is using the mouse wheel within the dialog to change the focus of the listbox record. I need to disable the mouse wheel only for this process.

Hmm, you mean that the mouse wheel is still working when you have a modal dialog box open? By definition, you cannot have focus on anything else in the same app while a modal dialog box is open. At least this is the way it is supposed to be.

If the mouse wheel is active, then are the arrow keys active also?

Further, Antonio's solution is not going to work for you since you want to be able to turn on and off the mouse wheel depending on a condition.

I think that there is either a flaw in your design, or a bug in FW if this is what is happening.

Maybe you meant a "non-modal" dialog?

Regards,
James

PostPosted: Wed Dec 03, 2008 10:08 pm
by Antonio Linares
Darrell,

If you just want to temporarly disable the user input on the browse, then you can do:

oBrowse:Disable()

and later on, when you are done:

oBrowse:Enable()