Page 1 of 1
different codepage or font issue ??
Posted: Wed Sep 28, 2011 3:04 am
by pierredaou
Hi,
I am converting foreign data from excel into DBF ( namely arabic ) . Now Advantage Data Architect reads the dbf file correctly ( ansi ), while Xdbu is not. Any hint about this issue ? How can I make the same file readable in Xbase ? is this a code page issue where can it be set ?
Regards
Re: different codepage or font issue ??
Posted: Sat Oct 01, 2011 7:49 am
by John Hohensee
Why not try the simple route use a second field that has a translated name?
Re: different codepage or font issue ??
Posted: Tue Oct 04, 2011 10:07 am
by pierredaou
Hi,
What do you mean by a second field that has a "translated name" ?
Regards
Re: different codepage or font issue ??
Posted: Tue Oct 04, 2011 11:14 am
by Auge_Ohr
pierredaou wrote:How can I make the same file readable in Xbase ? is this a code page issue where can it be set ?
not shure about arabic while i use chinese Sign
your 2nd Picture show a normal DBU using some "local System" Font which does not "match".
so use some Code like this to change Font "on-fly" in a Browse.
Code: Select all
oBrowse:itemRbDown := {| aMousePos, aRowCol, oSelf | ;
ChangeFont(aRowCol, oSelf) }
PROCEDURE ChangeFont(aRowCol,oBrowse)
LOCAL oFontDlg
LOCAL oFnt
LOCAL nPosi := aRowCol[2]
LOCAL OldFnt := oBrowse:GetColumn(nPosi):dataArea:setFont()
oFontDlg := XbpFontDialog():new(oBrowse) // Objekt erzeugen
oFontDlg:familyName := OldFnt:familyName
// Font-Dialog konfigurieren
oFontDlg:create() // Dialog anfordern
oFnt := oFontDlg:display() // Dialog aktivieren
IF oFnt <> NIL
MSGBOX("Font :"+LTRIM(STR(oFnt:nominalPointSize))+"."+;
oFnt:compoundName+CHR(13)+" Codepage :"+;
LTRIM(STR(oFnt:codePage)) )
oBrowse:GetColumn(nPosi):dataArea:setFont(oFnt)
oBrowse:refreshall()
ENDIF
oFontDlg:destroy()
RETURN
Note : every Column use a Font Object which have to setup before.
for more Informationen see Alaska Newsgroup
public.xbase++.generic
Mixing ANSI/ASCII and Unicode
Philip Jackson
21. Mai 2011
Re: different codepage or font issue ??
Posted: Tue Oct 04, 2011 11:40 pm
by pierredaou
thank you, I will try this.
Re: different codepage or font issue ??
Posted: Wed Oct 05, 2011 5:06 am
by pierredaou
Hi again,
it is not a matter of fonts, it is a matter of codepage. How can we set a default codepage in Xbase.
Regards
Re: different codepage or font issue ??
Posted: Wed Oct 05, 2011 8:08 am
by Auge_Ohr
pierredaou wrote:it is not a matter of fonts, it is a matter of codepage. How can we set a default codepage in Xbase.
only Font have Codepage which you can set.
using FontDialog you have to open ComboBox ( see Picture )
- Font_Codepage.JPG (75.15 KiB) Viewed 15400 times
Note : i use OEM so perhaps you have to use ConvToOemCP() to "convert back"
Re: different codepage or font issue ??
Posted: Sat Nov 05, 2011 10:40 pm
by pierredaou
Hi Jimmy, thank you and sorry for my late reply.
Still at point 0. Again, how can you invoke the FontDialog inside you PRG ( in a DCget for example ) "using all the installed fonts you have inside Windows".
Regards
Re: different codepage or font issue ??
Posted: Sun Nov 06, 2011 3:01 am
by Auge_Ohr
pierredaou wrote:Hi Jimmy, thank you and sorry for my late reply.
Still at point 0. Again, how can you invoke the FontDialog inside you PRG ( in a DCget for example ) "using all the installed fonts you have inside Windows".
sorry i´m not a Express++ User so i can´t say about DC* Function.
i use Xbase++
itemRbDown Slot in
XbpBrowse
with
:getColumn( <nColPos> ) -->
oXbpColumn.
after this i call Fontdialog and set it to
oXbpColumn.
you have to "set-up" Font to every Columne after
:addColumn()Code: Select all
imax := FCount()
aStruct := DbStruct()
FOR i:=1 TO imax
IF .NOT. aStruct[i,2] $ "BOVTXY"
oBrowse:addColumn( FieldBlockTrimmed(aStruct[i,1], aStruct[i,2]), , aStruct[i,1] )
ENDIF
NEXT
i := 0
FOR i := 1 TO imax
DO CASE
CASE i = 1
oBrowse:GetColumn( 1 ) :dataArea:setFont( oFnt1 )
CASE i = 2
IF ID_CHINA
oBrowse:GetColumn( 2 ) :dataArea:setFont( oFnt2 ) // second font
ELSE
oBrowse:GetColumn( 2 ) :dataArea:setFont( oFnt1 )
ENDIF
CASE i = 3
oBrowse:GetColumn( 3 ) :dataArea:setFont( oFnt1 )
CASE i = 4
IF ID_CHINA
oBrowse:GetColumn( 4 ) :dataArea:setFont( oFnt1 )
ELSE
oBrowse:GetColumn( 4 ) :dataArea:setFont( oFnt2 ) // second font
ENDIF
ENDCASE
NEXT
oFnt1 / oFnt2 are
XbpFont() Object (chinese / german) which are "set-up" before.
now you can use
itemRbDown Slot this Way
Code: Select all
...
oBrowse:itemRbDown := {| aMousePos, aRowCol, oSelf | ;
ChangeFont(aRowCol, oSelf) }
...
PROCEDURE ChangeFont(aRowCol,oBrowse)
LOCAL oFontDlg
LOCAL oFnt
LOCAL nPosi := aRowCol[2]
LOCAL OldFnt
LOCAL bSaveError := ERRORBLOCK( { | oError | BREAK( oError ) } )
//
// if no Font have been set before, it will CRASH here !!!
//
BEGIN SEQUENCE
OldFnt := oBrowse:GetColumn(nPosi):dataArea:setFont()
RECOVER USING oError
ERRORBLOCK( bSaveError )
msgbox("not FONT Object set to Columne before","Error old Font")
RETURN
END SEQUENCE
ERRORBLOCK( bSaveError )
oFontDlg := XbpFontDialog():new(oBrowse) // Objekt erzeugen
oFontDlg:familyName := OldFnt:familyName
// Font-Dialog konfigurieren
oFontDlg:create() // Dialog anfordern
oFnt := oFontDlg:display() // Dialog aktivieren
IF oFnt <> NIL
MSGBOX("Font :"+LTRIM(STR(oFnt:nominalPointSize))+"."+;
oFnt:compoundName+CHR(13)+" Codepage :"+;
LTRIM(STR(oFnt:codePage)) )
oBrowse:GetColumn(nPosi):dataArea:setFont(oFnt)
oBrowse:refreshall()
ENDIF
oFontDlg:destroy()
RETURN