Page 1 of 1

Spinner Get

Posted: Mon Oct 14, 2024 9:41 am
by Silvio.Falconi
I have a Spinner get

nPuntataIniziale := 0.50

@ nRow,nCol SAY oSay[1] PROMPT "Puntata iniziale" SIZE 100,24 PIXEL OF oDlg FONT oFont

@ nRow,nCol+150 GET aGet[4] VAR nPuntataIniziale SIZE 90,20 PIXEL OF oDlg FONT oFont SPINNER ON UP nPuntataIniziale+=0.50;
ON DOWN nPuntataIniziale-=0.50 MIN 0,50 MAX 200 RIGHTTOLEFT

I tried laso with
@ nRow,nCol+150 GET aGet[4] VAR nPuntataIniziale SIZE 90,20 PIXEL OF oDlg FONT oFont SPINNER ON UP 0.50;
ON DOWN 0.50 MIN 0,50 MAX 200 RIGHTTOLEFT

but not run

I wish the final user can press the spinner and add/ minus 0.50 on nPuntataIniziale min 0.50 max 200 , so where is the error ?

Re: Spinner Get

Posted: Mon Oct 14, 2024 10:18 am
by Antonio Linares
@ nRow,nCol+150 GET aGet[4] VAR nPuntataIniziale SIZE 90,20 PIXEL OF oDlg FONT oFont SPINNER ON UP aGet[ 4 ]:VarPut( nPuntataIniziale+=0.50 ) ;
ON DOWN aGet[ 4 ]:VarPut( nPuntataIniziale-=0.50 ) MIN 0,50 MAX 200 RIGHTTOLEFT

Re: Spinner Get

Posted: Mon Oct 14, 2024 12:36 pm
by Silvio.Falconi
Antonio Linares wrote:@ nRow,nCol+150 GET aGet[4] VAR nPuntataIniziale SIZE 90,20 PIXEL OF oDlg FONT oFont SPINNER ON UP aGet[ 4 ]:VarPut( nPuntataIniziale+=0.50 ) ;
ON DOWN aGet[ 4 ]:VarPut( nPuntataIniziale-=0.50 ) MIN 0,50 MAX 200 RIGHTTOLEFT

@ nRow,nCol+150 GET aGet[4] VAR nPuntataIniziale SIZE 90,20 PIXEL OF oDlg;
FONT oFont SPINNER ;
ON UP aGet[ 4 ]:VarPut( nPuntataIniziale+=0.50 ) ;
ON DOWN aGet[ 4 ]:VarPut( nPuntataIniziale-=0.50 ) ;
MIN 0,50 MAX 200 RIGHTTOLEFT


Compiling 'test.prg'...
test.prg(89) Error E0030 Syntax error "syntax error at '@'"

Re: Spinner Get

Posted: Mon Oct 14, 2024 1:18 pm
by karinha
Intenta asi:

Code: Select all | Expand

#include "FiveWin.ch"
#include "Constant.ch"

   @ 100, 10 GET aGet[4] VAR nPuntataIniziale SPINNER MIN 0.50 MAX 200 ;
      ON UP   GetStep( aGet[4]:VarPut( nPuntataIniziale += 0.50 ) )    ;
      ON DOWN GetStep( aGet[4]:VarPut( nPuntataIniziale -= 0.50 ) )    ;
      SIZE 90, 24 RIGHTTOLEFT PIXEL OF oDlg PICTURE "9999.99" UPDATE
 
Regards, saludos.

Re: Spinner Get

Posted: Mon Oct 14, 2024 2:59 pm
by alerchster
@ nRow,nCol+150 GET aGet[4] VAR nPuntataIniziale SIZE 90,20 PIXEL OF oDlg FONT oFont SPINNER ON UP 0.50;
ON DOWN 0.50 MIN 0,50 MAX 200 RIGHTTOLEFT

Code: Select all | Expand

@ nRow,nCol+150 GET aGet[4] VAR nPuntataIniziale SIZE 90,20 PIXEL OF oDlg FONT oFont SPINNER MIN 0.50 MAX 200 ;
     ON UP   GetStep( cGet,  0.50 ) ;
     ON DOWN GetStep( cGet, -0.50 ) ;
     RIGHTTOLEFT PICTURE "999.99" UPDATE
....

static function GetStep( oGet, nAdd )
   local nValue   := oGet:Value + nAdd
   nValue   := Max( Min( nValue, Eval( oGet:bMax ) ), Eval( oGet:bMin ) )
   oGet:cText  := nValue
   XEval( oGet:bChange )
return nil          
 

Re: Spinner Get

Posted: Tue Oct 15, 2024 8:22 am
by Silvio.Falconi
alerchster wrote:@ nRow,nCol+150 GET aGet[4] VAR nPuntataIniziale SIZE 90,20 PIXEL OF oDlg FONT oFont SPINNER ON UP 0.50;
ON DOWN 0.50 MIN 0,50 MAX 200 RIGHTTOLEFT

Code: Select all | Expand

@ nRow,nCol+150 GET aGet[4] VAR nPuntataIniziale SIZE 90,20 PIXEL OF oDlg FONT oFont SPINNER MIN 0.50 MAX 200 ;
     ON UP   GetStep( cGet,  0.50 ) ;
     ON DOWN GetStep( cGet, -0.50 ) ;
     RIGHTTOLEFT PICTURE "999.99" UPDATE
....

static function GetStep( oGet, nAdd )
   local nValue   := oGet:Value + nAdd
   nValue   := Max( Min( nValue, Eval( oGet:bMax ) ), Eval( oGet:bMin ) )
   oGet:cText  := nValue
   XEval( oGet:bChange )
return nil          
 


@ nRow,nCol+150 GET aGet[4] VAR nPuntataIniziale SIZE 90,20 PIXEL OF oDlg FONT oFont SPINNER MIN 0.50 MAX 200 ;
ON UP GetStep( aGet[4], 0.50 ) ;
ON DOWN GetStep( aGet[4], -0.50 ) ;
RIGHTTOLEFT PICTURE "999.99" UPDATE

make error
Error occurred at: 10/15/24, 10:21:34
Error description: Error BASE/1004 No exported method: EVAL
Args:
[ 1] = U

Stack Calls
===========
Called from: test.prg => (b)EVAL( 0 )
Called from: test.prg => GETSTEP( 138 )
Called from: test.prg => (b)PROGRESSIONI( 91 )
Called from: .\source\classes\tget.prg => (b)TGET_SPINNER( 3429 )

Re: Spinner Get

Posted: Tue Oct 15, 2024 8:23 am
by Silvio.Falconi
karinha wrote:Intenta asi:

Code: Select all | Expand

#include "FiveWin.ch"
#include "Constant.ch"

   @ 100, 10 GET aGet[4] VAR nPuntataIniziale SPINNER MIN 0.50 MAX 200 ;
      ON UP   GetStep( aGet[4]:VarPut( nPuntataIniziale += 0.50 ) )    ;
      ON DOWN GetStep( aGet[4]:VarPut( nPuntataIniziale -= 0.50 ) )    ;
      SIZE 90, 24 RIGHTTOLEFT PIXEL OF oDlg PICTURE "9999.99" UPDATE
 
Regards, saludos.
make error
Error description: Error BASE/1004 No exported method: VALUE
Args:
[ 1] = N 5.00

Stack Calls
===========
Called from: test.prg => VALUE( 0 )
Called from: test.prg => GETSTEP( 141 )

Re: Spinner Get

Posted: Tue Oct 15, 2024 8:31 am
by Silvio.Falconi
I resolve with

Code: Select all | Expand

@ nRow,nCol+150 GET aGet[4] VAR nPuntataIniziale SIZE 90,20 PIXEL OF oDlg FONT oFont SPINNER MIN 0.50 MAX 200 ;
     ON UP   GetStep(  aGet[4],  0.50,1,200 ) ;
     ON DOWN GetStep(  aGet[4], -0.50,1,200 ) ;
     RIGHTTOLEFT PICTURE "999.99" UPDATE

 static function GetStep( oGet, nAdd,nMin,nMax )
   local nValue   := oGet:Value + nAdd
   // nValue   := Max( Min( nValue, Eval( oGet:bMax ) ), Eval( oGet:bMin ) )

      nValue   := Max( Min( nValue, nMax ), nMin )
   oGet:cText  := nValue
   XEval( oGet:bChange )
return nil