different codepage or font issue ??

This forum is for eXpress++ general support.
Post Reply
Message
Author
pierredaou
Posts: 26
Joined: Thu Jan 28, 2010 3:23 am

different codepage or font issue ??

#1 Post 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
Attachments
file read in advantage
file read in advantage
Advantage.jpg (18.35 KiB) Viewed 14644 times
file read in ( Xdbu ) Xbase
file read in ( Xdbu ) Xbase
xbase.jpg (31.71 KiB) Viewed 14644 times

John Hohensee
Posts: 26
Joined: Fri Mar 04, 2011 7:35 am
Location: San Bernardino, CA USA
Contact:

Re: different codepage or font issue ??

#2 Post by John Hohensee »

Why not try the simple route use a second field that has a translated name?

pierredaou
Posts: 26
Joined: Thu Jan 28, 2010 3:23 am

Re: different codepage or font issue ??

#3 Post by pierredaou »

Hi,

What do you mean by a second field that has a "translated name" ?

Regards

User avatar
Auge_Ohr
Posts: 1414
Joined: Wed Feb 24, 2010 3:44 pm

Re: different codepage or font issue ??

#4 Post 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
greetings by OHR
Jimmy

pierredaou
Posts: 26
Joined: Thu Jan 28, 2010 3:23 am

Re: different codepage or font issue ??

#5 Post by pierredaou »

thank you, I will try this.

pierredaou
Posts: 26
Joined: Thu Jan 28, 2010 3:23 am

Re: different codepage or font issue ??

#6 Post 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

User avatar
Auge_Ohr
Posts: 1414
Joined: Wed Feb 24, 2010 3:44 pm

Re: different codepage or font issue ??

#7 Post 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
Font_Codepage.JPG (75.15 KiB) Viewed 14529 times
Note : i use OEM so perhaps you have to use ConvToOemCP() to "convert back"
greetings by OHR
Jimmy

pierredaou
Posts: 26
Joined: Thu Jan 28, 2010 3:23 am

Re: different codepage or font issue ??

#8 Post 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

User avatar
Auge_Ohr
Posts: 1414
Joined: Wed Feb 24, 2010 3:44 pm

Re: different codepage or font issue ??

#9 Post 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
greetings by OHR
Jimmy

Post Reply