Mouse wheel scrolling in get spinner?

Post Reply
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Mouse wheel scrolling in get spinner?

Post by Otto »

How can I get mouse wheel to invoke the up and down actions in a get spinner.
Thanks in advance
Otto
Natter
Posts: 524
Joined: Mon May 14, 2007 9:49 am

Post by Natter »

oGet:oVScroll:bGoUp
bGoDown
..............
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Thank you for your help. I tried your code but it didn't work.
Does someone have a get class changed for mousewheel support?
Thanks in advance
Otto
Natter
Posts: 524
Joined: Mon May 14, 2007 9:49 am

Post by Natter »

FUNCTION MAIN()
local nVal := -1
local oGet
private oDlg

DEFINE DIALOG oDlg

@ 1,1 GET oGet VAR nVal;
PICTURE "999" SPINNER
oGet:bChange:={||MyFun()}

@ 1,15 SAY "..."

ACTIVATE DIALOG oDlg CENTER

RETURN NIL

procedure MyFun
oDlg:aControls[2]:SetText(oDlg:aControls[1]:cText())
return
[/code]
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Hello Natter,
thank you for your sample.
I compiled the sample but here mouse wheel does not work.
I think a get field with mouse wheel support should work either if you click on the scrollbar or it the field has focus and you turn the wheel.
And this is not happen.
Regards,
Otto
User avatar
mmercado
Posts: 782
Joined: Wed Dec 19, 2007 7:50 am
Location: Salamanca, Gto., México

Post by mmercado »

Otto wrote:I compiled the sample but here mouse wheel does not work.
Hi Otto:

Taking the Natter's sample try this:

Code: Select all

#include "Fivewin.ch"

Static oGet

Function Main()

   Local oGet, oDlg, ;
         nVal := -1

   DEFINE DIALOG oDlg

   TGet_Modify()

   @  1,  1 GET oGet VAR nVal ;
            PICTURE "999" SPINNER

   oGet:bChange:={ || MyFun( oDlg ) }

   @  1, 15 SAY "..."

   ACTIVATE DIALOG oDlg CENTERED

Return Nil

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

Static Function MyFun( oDlg )

   oDlg:aControls[ 2 ]:SetText( oDlg:aControls[ 1 ]:cText() )

Return Nil

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

Static Function TGet_Modify()

  Override Method MouseWheel In Class TGet With UseTheWheel

Return Nil

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

Static Function UseTheWheel( nKey, nDelta, nXPos, nYPos )

   Local Self := QSelf()

   If nDelta > 0
      Self++
   Else
      Self--
   EndIf

Return Nil
Best regards.

Manuel Mercado
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Hello Manuel,

Thank you very much for your help. This is working.

I must figure out how to implement this method into TGet class.
I use Harbour too and override I think does not exist in Harbour.

I have uploaded the snip to:
http://www.fwcodesnips.com/

Regards,
Otto
User avatar
mmercado
Posts: 782
Joined: Wed Dec 19, 2007 7:50 am
Location: Salamanca, Gto., México

Post by mmercado »

Otto wrote:I must figure out how to implement this method into TGet class.
The main virtue of Override and Extend procedures is not having to touch original classes for solve very specific cases.

Besides, I'm sure that Antonio has take note of your request for retouching TGet accordantly in a future FWH release.
Otto wrote:I use Harbour too and override I think does not exist in Harbour.
Unfortunately no (at least up to my version 8.02), we hope that the Harbour's people to implement it soon.

Best regards.

Manuel Mercado
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Otto,

Is there a reason that you are not using xHarbour for everything? I use xHarbour exclusively.

James
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Hello James, hello Manuel,

Thank you for your help.
No there is not really a reason why I use both.

I tried to insert the method in TGet. I think it should only work on Gets with spinner. Therefore I inserted the proof for lSpinner.

Regards,
Otto

METHOD MouseWheel( nKeys, nDelta, nXPos, nYPos )
IF ::lSpinner=.t.
If nDelta > 0
Self++
Else
Self--
EndIf
ENDIF

Return Nil

//---------------------------------------------------------//
Post Reply