How i can replace a get caracter when typing

How i can replace a get caracter when typing

Postby Wanderson » Tue Sep 11, 2012 11:24 am

Hello,

How i can replace a get caracter when typing, try this but doesn't work and i want after replace send the cursor to last caracter get position to continue typing.
Thanks in advance!

...

REDEFINE GET oGet52 VAR oArqCli:RAZAO ID 103 of oDlg1 picture '@!' COLOR Frente,Fundo update
oGet52:bChange := {|nKey| Rep_Get(nKey)}

...



Static Function Rep_Get(nKey)
StrTran(oGet52:cText,"Ã","A") <----- dont work
StrTran(oArqCli:RAZAO,"Ã","A") <----- dont work too
oGet52:Refresh()
Return .t.
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

Re: How i can replace a get caracter when typing

Postby MarcoBoschi » Tue Sep 11, 2012 2:00 pm

Off topic?


Code: Select all  Expand view
#include "fivewin.ch"


FUNCTION MAIN()
LOCAL oDlg , oBut
LOCAL oGet , cGet := "                        "
LOCAL aStran := {}

AADD ( aStran ,  { "A" , "1" } )
AADD ( aStran ,  { "B" , "2" } )
AADD ( aStran ,  { "C" , "3" } )
AADD ( aStran ,  { "D" , "4" } )
AADD ( aStran ,  { "E" , "5" } )
AADD ( aStran ,  { "F" , "6" } )

DEFINE DIALOG oDlg


@ 1 , 1 GET oGet  VAR cGet OF oDlg

oGet:bKeyChar := { | nKey | nKey := Rep_get( nKey , aStran )  }

@ 2 , 2 BUTTON oBut OF oDlg


ACTIVATE DIALOG oDlg
RETURN NIL


FUNCTION REP_GET( nKey , aStran )
LOCAL cChar := CHR( nKey )
LOCAL i

FOR i := 1 TO LEN( aStran )

    IF aStran[ i , 1 ] = cChar
       nKey := ASC( aStran[ i , 2 ] )
       KEYBOARD CHR( nKey )
       nKey := 0
       EXIT
    ENDIF

NEXT i


RETURN nkey
 
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: How i can replace a get caracter when typing

Postby Wanderson » Tue Sep 11, 2012 2:51 pm

MarcoBoschi wrote:Off topic?


Code: Select all  Expand view
#include "fivewin.ch"


FUNCTION MAIN()
LOCAL oDlg , oBut
LOCAL oGet , cGet := "                        "
LOCAL aStran := {}

AADD ( aStran ,  { "A" , "1" } )
AADD ( aStran ,  { "B" , "2" } )
AADD ( aStran ,  { "C" , "3" } )
AADD ( aStran ,  { "D" , "4" } )
AADD ( aStran ,  { "E" , "5" } )
AADD ( aStran ,  { "F" , "6" } )

DEFINE DIALOG oDlg


@ 1 , 1 GET oGet  VAR cGet OF oDlg

oGet:bKeyChar := { | nKey | nKey := Rep_get( nKey , aStran )  }

@ 2 , 2 BUTTON oBut OF oDlg


ACTIVATE DIALOG oDlg
RETURN NIL


FUNCTION REP_GET( nKey , aStran )
LOCAL cChar := CHR( nKey )
LOCAL i

FOR i := 1 TO LEN( aStran )

    IF aStran[ i , 1 ] = cChar
       nKey := ASC( aStran[ i , 2 ] )
       KEYBOARD CHR( nKey )
       nKey := 0
       EXIT
    ENDIF

NEXT i


RETURN nkey
 


Thanks a lot, works great!
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 105 guests