Edit / Write OemToansi / AnsiToOem with xBrowse ?

Post Reply
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Edit / Write OemToansi / AnsiToOem with xBrowse ?

Post by ukoenig »

Hello
Is there somebody, who got a working sample to read / write
OemToAnsi - data with xbrowse ( for old database from Clipper-time )?
I looked at a Array-sample
The following shows just what i mean and just a idea i think it should look
it's not working because of the syntax.

Code: Select all


// At the start, i define a var < lOemAnsi = .T. >
// if i want to show data OemToAnsi-look  in xBrowse 

// The normal first lines 
// -------------------------

DBSELECTAREA(cAlias1)

oBrw5 := TXBrowse():New( oDlg )

oBrw5:nMarqueeStyle		:= MARQSTYLE_HIGHLROW
oBrw5:nColDividerStyle	:= LINESTYLE_BLACK
oBrw5:nRowDividerStyle	:= LINESTYLE_BLACK
oBrw5:lColDividerComplete	:= .t.
oBrw5:nHeaderLines		:= 1
oBrw5:nDataLines		:= 1
oBrw5:lAllowColSwapping           := .t.
oBrw5:SetRDD()

FOR nFor := 1 TO Fcount()   //  Fields
     oCol := oBrw5:aCols[ nFor ]

     // If I set VAR  lOemAnsi = .T. it must show OemToAnsi-Format
     // -------------------------------------------------------------------- 
     oCol:bStrData   := {|o, v, n| ;
     oCol:bEditvalue := {|| PADR( cValToChar( ;
     IIF( FIELD o:nCreationOrder, v) = "C" .and. lOemAnsi = .T., ;
     OemToAnsi( (cAlias1)->(FieldGet(o:nCreationOrder, v )) ), ;
     (cAlias1)->(FieldGet(o:nCreationOrder, v )) ), nMaxWidth ) } }
     oCol:nEditType := 1

     // I want edit a COL 
     // with a function to check Var-types 
     // ---------------------------------------
     oCol:bOnPostEdit := { | oCol, xValue, nLastKey | ;
     OnEdit( oCol, xValue, nLastKey ) }

NEXT
.......
.......
.......

//-- I have to write Data back with AnsiToOem
//   ( a sample I found with array-data )--

STATIC FUNCTION OnEdit( oCol, xValue, nLastKey )
local oBrw  := oCol:oBrw

IF nLastKey == 13
    IF NET_RLOCK() 
          // must write back AnsitoOem
         // ------------------------------------
         CASE 'C' .and. lOemAnsi = .T.
	xValue   := AnsiToOem( xValue )
	EXIT	
        CASE 'N'
	xValue   := Val( xValue )
	EXIT
        CASE 'D'
	xValue   := CTOD( ALLTRIM( xValue ) )
	EXIT
        CASE 'L'
	xValue   := ( Upper( Left ( LTrim( xValue ), 1 ) ) $ "YT" )
	EXIT
         // DEFAULT
       END
       (cAlias1)->( FieldPut( oBrw: ?????, xValue ) )
       oBrw:DrawLine( .t. )
       oBrw:Cargo:DrawLine( .t. )
       NET_ULOCK()
   ENDIF
ENDIF

RETURN NIL
Somebody knows, how could it be done ?

Regards
Uwe :lol: [/code]
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
Post Reply