Page 1 of 1

GET....Valid error RESOLVED

Posted: Fri Nov 27, 2020 11:00 am
by Silvio.Falconi
I have on a dialog
local cArchiv := Space( 40 )
..
@ 115,55 GET oGetArc VAR cArchiv size 200,11 PIXEL OF oDlgSalvaRpt ;
VALID iif( Empty( RTrim(cArchiv ) ), MsgStop( "E' obbligatorio introdurre un nome per l'archivio.",'Attenzione' ), .T. )

If I click on get and the go to another before show me the message and then crash
Why ?

make me this error

Code: Select all

   
   Error occurred at: 27-11-2020, 11:55:06
   Error description: Error BASE/1066  Parametro errato: condizionale
   Args:
     [   1] = U   

Stack Calls
===========
   Called from: .\source\classes\TGET.PRG => TGET:LVALID( 2128 )
   Called from: .\source\classes\CONTROL.PRG => TGET:FWLOSTFOCUS( 1205 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1802 )
   Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 1159 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3559 )
   Called from:  => DIALOGBOXINDIRECT( 0 )

Re: GET....Valid error

Posted: Fri Nov 27, 2020 2:04 pm
by karinha
Siempre publique el ejemplo completo Silvio, como en el siguiente ejemplo:

Code: Select all

#include "fivewin.ch"
#include "inkey.ch"

static oWnd

FUNCTION Main()

   LOCAL oMenu, oBar
   
   MENU oMenu

      MenuItem "From Code" action FromCode( oWnd )

      // MenuItem "From Resource" action FromrES( oWnd )

   endmenu

   DEFINE WINDOW oWnd TITLE "3D objects" MENU oMenu pixel

   DEFINE BUTTONBAR oBar _3D OF oWnd

   DEFINE BUTTON OF oBar ACTION FromCode( oWnd )

   SET MESSAGE OF oWnd TO "3D Objects" NOINSET CLOCK DATE KEYBOARD
   
   ACTIVATE WINDOW oWnd MAXIMIZED
 
RETURN oWnd

FUNCTION FromCode( oWnd )

   LOCAL oDlg
   LOCAL oGet1, oGet2, oGet3, oGet4
   LOCAL cVar1, cVar2, cVar3, cVar4
   LOCAL lActive := .F.
   LOCAL cArchiv := SPACE( 40 )

   
   cVar1 := 0
   cVar2 := 0
   cVar3 := 0
   cVar4 := 0
   
   
   define dialog oDlg title "From Code" pixel size 300, 300

   @ 10, 10 GET oGet1 VAR cArchiv bitmap "C:\FWH1905\bitmaps\on.bmp"         ;
      ACTION( msginfo( "Un día aprendo FiveWin. I love FiveWin." ) )         ;
      of oDlg pixel size 60, 12                                              ;
      VALID( OBBLIGATORIO_SILVIO( cArchiv, oGet1, oDlg ) )

   @ 40, 10 GET oGet2 VAR cVar2 bitmap "C:\FWH1905\bitmaps\on.bmp" action( msginfo( "Without Transparent" ) ) of oDlg pixel size 60, 12

   @ 70, 10 GET oGet3 VAR cVar3 bitmap "C:\FWH1905\bitmaps\chkyes.bmp" action( msginfo( "With Adjust-Transparent" ) ) of oDlg pixel size 120, 12

   @ 100, 10 GET oGet4 VAR cVar4 bitmap "C:\FWH1905\bitmaps\chkyes.bmp" ;
      action( if( lActive,oGet3:disable(),oGet3:enable() ), lActive := !lActive, oDlg:update() ) of oDlg pixel size 120, 12
   
   oGet1:lBtnTransparent := .T.       // transparent button get oGet1
   
   oGet3:disable()
   oGet3:lBtnTransparent := .T.       // transparent button get oGet3
   oGet3:lAdjustBtn      := .T.       // Button Get Adjust Witdh oGet3
   oGet3:lDisColors      := .F.       // Deactive disable color
   oGet3:nClrTextDis     := CLR_WHITE // Color text disable status
   oGet3:nClrPaneDis     := CLR_BLUE  // Color Pane disable status
   
   oGet4:lAdjustBtn      := .T.
   
   activate dialog oDlg centered

 
RETURN nil

FUNCTION OBBLIGATORIO_SILVIO( cArchiv, oGet1, oDlg )

   IF( .NOT. EMPTY( RTrim( cArchiv ) ) ) // full

      MsgInfo( "Perfecto Silvio - OOP -> POO - Hay dados." )

   ELSE  // vacio

      MsgInfo( "E' obbligatorio introdurre un nome per l'archivio.", "Attenzione Hombre de Dios." )

      RETURN( .F. )

   ENDIF

RETURN( .T. )

// FIN - kapiabafwh@gmail.com
 
Regards, saludos.

Re: GET....Valid error

Posted: Fri Nov 27, 2020 6:21 pm
by Silvio.Falconi
karinha wrote:Siempre publique el ejemplo completo Silvio, como en el siguiente ejemplo:




Regards, saludos.

Sorry But

IF I use resources run ok with

REDEFINE GET oGetArc VAR cArchiv ID 202 OF ODlg ;
VALID iif( Empty( RTrim(cArchiv ) ), MsgStop( 'It is mandatory to enter a name for the file.','Attention' ), .T. )

why on source (@x,y) not run ??????

Re: GET....Valid error

Posted: Fri Nov 27, 2020 6:43 pm
by Silvio.Falconi
resolved with

@ 136,55 GET oGetArc VAR cArchiv size 150,11 PIXEL OF oDlgSalvaRpt ;
VALID ValEmpty( cArchiv, oGetArc )

FUNCTION ValEmpty( cDato, oGet )
IF empty( cDato )
MsgStop( i18n( "E' obbligatorio riempire questo campo." ) )
oGet:setFocus()
RETURN .F.
END IF
RETURN .T.