Mouse wheel scrolling in get spinner?

Mouse wheel scrolling in get spinner?

Postby Otto » Wed May 28, 2008 9:14 am

How can I get mouse wheel to invoke the up and down actions in a get spinner.
Thanks in advance
Otto
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Postby Natter » Thu May 29, 2008 11:19 am

oGet:oVScroll:bGoUp
bGoDown
..............
Natter
 
Posts: 1221
Joined: Mon May 14, 2007 9:49 am

Postby Otto » Thu May 29, 2008 9:10 pm

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
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Postby Natter » Thu May 29, 2008 10:28 pm

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]
Natter
 
Posts: 1221
Joined: Mon May 14, 2007 9:49 am

Postby Otto » Fri May 30, 2008 5:13 am

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
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Postby mmercado » Fri May 30, 2008 6:47 am

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  Expand view  RUN
#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
mmercado
 
Posts: 782
Joined: Wed Dec 19, 2007 7:50 am
Location: Salamanca, Gto., México

Postby Otto » Fri May 30, 2008 10:07 am

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
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Postby mmercado » Fri May 30, 2008 2:05 pm

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
mmercado
 
Posts: 782
Joined: Wed Dec 19, 2007 7:50 am
Location: Salamanca, Gto., México

Postby James Bott » Fri May 30, 2008 2:26 pm

Otto,

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

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

Postby Otto » Fri May 30, 2008 3:34 pm

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

//---------------------------------------------------------//
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 63 guests