I'm working on a solution to translate fields with xBrowse ( character )
to other languages.
The 1. browser shows the fields for different languages
English is the reference and is the first record.
Changing the language I can translate the word in browser 2 ( for the moment )
I remember a sample to edit a record as a xbrowse-fieldlist but couldn't find
I must work in 3 browser and cannot use the edit-solution
What I would like to do for easy translation :
to show the english language ( record 1 ) in browser 2
selecting other languages in browser 1 ( records > 1 ) must be shown in browser 3 ( NOT using edit shown in picture above )
and keeps english visible.
That makes it possible to compare a other language with english for translation
It works and I can replace fixed text with vars but I must switch between english and the new language for translation.
I'm just adding a solution to change a fieldsize if needed ( that belongs to the different languages ).
- Code: Select all Expand view RUN
FUNCTION PAGE4( oFld )
LOCAL oData1, oData2, oStru
REDEFINE XBROWSE oData1 ID 910 of oFld:aDialogs[ 4 ] ;
DATASOURCE oLanguage AUTOCOLS AUTOSORT CELL LINES NOBORDER FASTEDIT
REDEFINE XBROWSE oStru ID 920 of oFld:aDialogs[ 4 ] ;
DATASOURCE oLanguage:DbStruct() ;
COLUMNS 1,2,3,4, ;
{ |x| If( x == nil, oLanguage:FieldGet( oStru:nArrayAt ), ;
If( oLanguage:Lock(), ( oLanguage:FieldPut( oStru:nArrayAt, x ), oLanguage:UnLock() ), nil ) ) } ;
HEADERS "FldName","Typ","Len","Dec", "FieldValue" ;
COLSIZES 90, 40, 40, 40, 110 ;
JUSTIFY AL_LEFT, AL_CENTER, AL_CENTER, AL_CENTER, AL_LEFT ;
AUTOCOLS CELL LINES NOBORDER FASTEDIT
REDEFINE XBROWSE oData2 ID 930 of oFld:aDialogs[ 4 ] ;
DATASOURCE oLanguage // for translation
// ????????????
WITH OBJECT oData1
:bClrSel := { || { CLR_BLACK, CLR_HGRAY }}
:bClrEdits := { || { CLR_BLACK, CLR_YELLOW }}
:lColChangeNotify := .t.
:bChange := { || oStru:nArrayAt := oData1:SelectedCol():nCreationOrder, oStru:Refresh() }
//
:nEditTypes := EDIT_GET
:bOnChanges := { || oStru:Refresh() }
END
WITH OBJECT oStru
:bClrSel := { || { CLR_BLACK, CLR_HGRAY }}
:bChange := { || oData1:SelectCol( oData1:ColPos( oData1:oCol( oStru:nArrayAt ) ), .t. ) }
:nStretchCol := 5
//
WITH OBJECT :aCols[ 5 ]
:nEditType := EDIT_GET
:bClrEdit := { || { CLR_BLACK, CLR_YELLOW }}
:bOnChange := { || oLanguage:Save(), oData1:RefreshCurrent() }
END
//
END
WITH OBJECT oData2 // translation
:bClrSel := { || { CLR_BLACK, CLR_HGRAY }}
:bClrEdits := { || { CLR_BLACK, CLR_YELLOW }}
:lColChangeNotify := .t.
// :bChange := ???????
//
:nEditTypes := EDIT_GET
:bOnChanges := { || oStru:Refresh() }
END
RETURN( NIL )
regards
Uwe