Augusto escreveu:
Então, quando você colocar na PICTURE a expressão "@M", o GET só vai aceitar letras minúsculas...
Nesse caso nem é necessário IF/ENDIF, só o PICT "@40!" após o GET, sendo 40 o total de caracteres desejados.

Moderador: Moderadores
Augusto escreveu:
Então, quando você colocar na PICTURE a expressão "@M", o GET só vai aceitar letras minúsculas...
diogenes_varela escreveu:Explique-me, por favor, o motivo da sua fúria...
// NOTE: compile with /m /n
#include "Inkey.ch"
#include "Getexit.ch"
/***
* Nation Message Constants
* These constants are used with the NationMsg(<msg>) function.
* The <msg> parameter can range from 1-12 and returns the national
* version of the system message.
*/
#define _GET_INSERT_ON 7 // "Ins"
#define _GET_INSERT_OFF 8 // " "
#define _GET_INVD_DATE 9 // "Invalid Date"
#define _GET_RANGE_FROM 10 // "Range: "
#define _GET_RANGE_TO 11 // " - "
#define K_UNDO K_CTRL_U
// State variables for active READ
STATIC sbFormat
STATIC slUpdated := .F.
STATIC slKillRead
STATIC slBumpTop
STATIC slBumpBot
STATIC snLastExitState
STATIC snLastPos
STATIC soActiveGet
STATIC scReadProcName
STATIC snReadProcLine
//
// Format of array used to preserve state variables
//
#define GSV_KILLREAD 1
#define GSV_BUMPTOP 2
#define GSV_BUMPBOT 3
#define GSV_LASTEXIT 4
#define GSV_LASTPOS 5
#define GSV_ACTIVEGET 6
#define GSV_READVAR 7
#define GSV_READPROCNAME 8
#define GSV_READPROCLINE 9
#define GSV_COUNT 9
/***
*
* ReadModal()
*
* Standard modal READ on an array of GETs
*
*/
FUNCTION ReadModal( GetList, nPos )
LOCAL oGet
LOCAL aSavGetSysVars
IF ( VALTYPE( sbFormat ) == "B" )
EVAL( sbFormat )
ENDIF
IF ( EMPTY( GetList ) )
// S'87 compatibility
SETPOS( MAXROW() - 1, 0 )
RETURN (.F.) // NOTE
ENDIF
// Preserve state variables
aSavGetSysVars := ClearGetSysVars()
// Set these for use in SET KEYs
scReadProcName := PROCNAME( 1 )
snReadProcLine := PROCLINE( 1 )
// Set initial GET to be read
IF !( VALTYPE( nPos ) == "N" .AND. nPos > 0 )
nPos := Settle( Getlist, 0 )
ENDIF
WHILE !( nPos == 0 )
// Get next GET from list and post it as the active GET
PostActiveGet( oGet := GetList[ nPos ] )
// Read the GET
IF ( VALTYPE( oGet:reader ) == "B" )
EVAL( oGet:reader, oGet ) // Use custom reader block
ELSE
GetReader( oGet ) // Use standard reader
ENDIF
// Move to next GET based on exit condition
nPos := Settle( GetList, nPos )
ENDDO
// Restore state variables
RestoreGetSysVars( aSavGetSysVars )
// S'87 compatibility
SETPOS( MAXROW() - 1, 0 )
return ( slUpdated )
/***
*
* GetReader()
*
* Standard modal read of a single GET
*
*/
PROCEDURE GetReader( oGet )
// Read the GET if the WHEN condition is satisfied
IF ( GetPreValidate( oGet ) )
// Activate the GET for reading
oGet:setFocus()
WHILE ( oGet:exitState == GE_NOEXIT )
// Check for initial typeout (no editable positions)
IF ( oGet:typeOut )
oGet:exitState := GE_ENTER
ENDIF
// Apply keystrokes until exit
WHILE ( oGet:exitState == GE_NOEXIT )
if UPPER(READVAR())="CMAIL"
VK:=INKEY(0)
KCLP:=.t. // Permite F10 para clipboard
KLOW:=.t. // Permite caracteres minusculas
KUPP:=.f. // Permite caracteres maiusculas
KNUM:=.t. // Permite caracteres numericos
KOUT:="@._-" // Permite esse caracteres definidos
DO CASE
CASE VK=-9 .AND. KCLP=.T.
VCHR:=CLIP_BOARD()
FOR IC=1 TO LEN(ALLTRIM(VCHR))
GetApplyKey( oGet, ASC(SUBSTR(VCHR,IC,1)) )
NEXT
CASE AT(CHR(VK),KOUT)>0 // Outros caracteres
VCHR:=CHR(VK)
CASE VK=128 .AND. !(KLOW=.F. .AND. KUPP=.F.) // Ç
IF KUPP=.T.
VCHR:=CHR(VK)
ELSE
VCHR:=CHR(135)
ENDIF
CASE VK=135 .AND. !(KLOW=.F. .AND. KUPP=.F.) // ç
IF KLOW=.T.
VCHR:=CHR(VK)
ELSE
VCHR:=CHR(128)
ENDIF
CASE VK>96 .AND. VK<123 .AND. !(KLOW=.F. .AND. KUPP=.F.) // a-z
IF KLOW=.T.
VCHR:=CHR(VK)
ELSE
VCHR:=UPPER(CHR(VK))
ENDIF
CASE VK>64 .AND. VK<91 .AND. !(KLOW=.F. .AND. KUPP=.F.) // A-Z
IF KUPP=.T.
VCHR:=CHR(VK)
ELSE
VCHR:=LOWER(CHR(VK))
ENDIF
CASE VK>47 .AND. VK<58 .AND. KNUM=.T. // 0-9
VCHR:=CHR(VK)
CASE VK=4
VCHR:=CHR(VK)
CASE VK=19
VCHR:=CHR(VK)
CASE VK=1
VCHR:=CHR(VK)
CASE VK=25
VCHR:=CHR(VK)
CASE VK=7
VCHR:=CHR(VK)
CASE VK=6
VCHR:=CHR(VK)
CASE VK=5
VCHR:=CHR(VK)
CASE VK=24
VCHR:=CHR(VK)
CASE VK=8
VCHR:=CHR(VK)
CASE VK=13
VCHR:=CHR(VK)
CASE VK=27
VCHR:=CHR(VK)
OTHERWISE
VCHR:=""
ENDCASE
GetApplyKey( oGet, ASC(VCHR) )
ELSE
GetApplyKey( oGet, INKEY(0) )
ENDIF
ENDDO
// Disallow exit if the VALID condition is not satisfied
IF ( !GetPostValidate( oGet ) )
oGet:exitState := GE_NOEXIT
ENDIF
enddo
// De-activate the GET
oGet:killFocus()
endif
return
LOCAL GetList := {}
cls
cEmail=SPAC(40)
@ 10,10 SAY "Endereco de E-mail:" GET cEmail VALID { |oGet| L_OWER(oGet,cEmail) }
READ
RETU
FUNC L_OWER(oGet,v_email)
oGet:buffer := LOWER(v_email)
oGet:assign()
retu .T.
@ 5, 5 get mEmail VALID ReturnValue( .T., mEmail := Lower( mEmail ) )
FUNCTION ReturnValue( xValue, ... )
RETURN xValue
Usuários vendo este fórum: Nenhum usuário registrado online e 4 visitantes