Jump to content
Fivewin Brasil

Converter Minusculas em Maiusculas


kapiaba

Recommended Posts

Só documentando, caso alguém pergunte:

// Testing GETs \samples\testget.prg
#include "FiveWin.ch"
 
#define CLR_MENTA          RGB(221,255,238)
#define CLR_HMENTA         RGB(000,128,000)
#define CLR_SOFTYELLOW     RGB(255,251,225)
 
function Main()
 
   LOCAL oDlg, oGet
   LOCAL cCad := "Testing Upper    " // pad("Testing Gets",40)
   LOCAL nNum := 0
   LOCAL dDat := Date()
 
   Set century On
   Set Date Ansi
   Set Date format "mm/dd/yyyy"
 
   SET _3DLOOK ON
 
   SetGetColorFocus( CLR_MENTA )
 
   tGet():lDisColors  := .F. //FALSE
   tGet():nClrTextDis := CLR_BLUE
   tGet():nClrPaneDis := CLR_SOFTYELLOW
 
   DEFINE DIALOG oDlg TITLE "TGet from " + FWDESCRIPTION
 
   @ 1,    2 SAY "Text..:" OF oDlg
 
   //@ 1,    6 GET oGet VAR cCad OF oDlg SIZE 60, 10 COLOR "W/G" PICTURE "@K"
 
   @ 1,    6 Get oGet var cCad multiline of oDlg ;
             COLORS CLR_HRED, CLR_WHITE          ; //READONLY
             ON CHANGE( CONVERT( oGet, cCad ) )
 
   @ 1.8,  2 SAY "Number:" OF oDlg
 
   //@ 2,    6 GET oGet VAR nNum OF oDlg SIZE 60, 10 PICTURE "9999999.99"
 
   @ 2.6,  2 SAY "Date:" OF oDlg
 
   //@ 3,    6 GET oGet VAR dDat PICTURE "@E" OF oDlg SIZE 60, 10  // "@D"
 
   @ 3,    7 BUTTON "&Ok" OF oDlg SIZE 30, 12 ACTION oDlg:End()
   @ 3,   16 BUTTON "&Cancel" SIZE 30, 12 OF oDlg ACTION oDlg:End() CANCEL
   
   // TGet():SetColorFocus( nRGB( 200, 120, 120 ) )
 
   ACTIVATE DIALOG oDlg CENTERED
 
return nil
 
Function CONVERT( oGet, cTexto )
 
   LOCAL cText
 
   // remove branco
   cTexto := StrTran( cTexto, " ", " " )
   // acento agudo
   cTexto := StrTran( cTexto, "Á", "A" )
   cTexto := StrTran( cTexto, "É", "E" )
   cTexto := StrTran( cTexto, "Í", "I" )
   cTexto := StrTran( cTexto, "Ó", "O" )
   cTexto := StrTran( cTexto, "Ú", "U" )
   // acento circunflexo
   cTexto := StrTran( cTexto, "Â", "A" )
   cTexto := StrTran( cTexto, "Ê", "E" )
   cTexto := StrTran( cTexto, "Î", "I" )
   cTexto := StrTran( cTexto, "Ô", "O" )
   cTexto := StrTran( cTexto, "Û", "U" )
   // til
   cTexto := StrTran( cTexto, "Ã", "A" )
   cTexto := StrTran( cTexto, "Õ", "O" )
   // ce-cedilha
   cTexto := StrTran( cTexto, "Ç", "C" )
   // trema
   cTexto := StrTran( cTexto, "Ü", "U" )
   // crase
   cTexto := StrTran( cTexto, "À", "A" )
   cTexto := StrTran( cTexto, "È", "E" )
   cTexto := StrTran( cTexto, "Ì", "I" )
   cTexto := StrTran( cTexto, "Ò", "O" )
   cTexto := StrTran( cTexto, "Ù", "U" )
 
   cText := UPPER( cTexto )
 
   oGet:VarPut( cText )
   oGet:Refresh()
 
Return( cText )
Link to comment
Share on other sites

Continuação:

http://forums.fivetechsupport.com/viewtopic.php?f=6&t=28124&start=0

Aunque ya te ha contestado Joao, prueba con:

@ 1, 6 Get oGet var cCad multiline of oDlg ;
COLORS CLR_HRED, CLR_WHITE //READONLY
oget:bchange := {|nkey| cCad := strtran( cCad, chr(nkey), upper(chr(nkey)) ), oCad:Refresh() }

Saludos

Sebastián Almirón

Link to comment
Share on other sites

Olá Kapiaba, acredito que a conversão das letras que possuem acentuação não está correta, pois o STRTRAN irá procurar a letra com acento já em maiúsculo para retirar o acento e manter em maiúsculo

e acredito que deveria ser o contrário ^^

Abraço.

Acho que você está correto, isto é somente um exemplo, fiz na pressa, para responder um colega no forum inter. Nem sei se no teclado em espanhol, tenha acentuação. Obg. Abs.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...