Spinner Question

Post Reply
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Spinner Question

Post by Jeff Barnes »

Hi Everybody,

How can I have a spinner increase/decrease by 0.5 instead of 1


Thanks,

Jeff
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Jeff,

Search for these lines in source\classes\tget.prg and change the 1 into 0.5:

Code: Select all

      If nDirection > 0
         nValue += 1 / ( 10 ^ nDec )
      else
         nValue -= 1 / ( 10 ^ nDec )
      Endif
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Post by Jeff Barnes »

Thanks for the quick reply Antonio but that will not solve my probelm.

I use 4 different spinners, only one of them needs to adjust by 0.5 the rest of them need to adjust by 1


Jeff
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

This is a working sample:

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL oGet, nVar := 1

    DEFINE DIALOG oDlg

    @ 1, 1 GET oGet VAR nVar;
           PICTURE "99.9";
           SPINNER

    oGet:oVScroll:bGoUp = { || If( GetFocus() != oGet:hWnd, oGet:SetFocus(), ),;
                               nVar += 0.5,;
                               oGet:Refresh() }

    oGet:oVScroll:bGoDown = { || If( GetFocus() != oGet:hWnd, oGet:SetFocus(), ),;
                                 nVar -= 0.5,;
                                 oGet:Refresh() }

    @ 3, 1 BUTTON "&Close";
           ACTION oDlg:End()

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL
EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Enrico,

You are right. Thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Post by Jeff Barnes »

Thanks Enrico,

That's exactly what I needed.

Jeff
Post Reply