Font in DCBROWSE

This forum is for eXpress++ general support.
Post Reply
Message
Author
Andy Edward
Posts: 103
Joined: Fri Sep 17, 2010 2:58 am

Font in DCBROWSE

#1 Post by Andy Edward »

Hi Roger,

In my DCBROWSE command I use the FONT parameter as such

Code: Select all

@ nRow + IIF(lAutoSeek,1.5*IIF(lPixel,20,1),0), nCol DCBROWSE aData[1] ;
FONT cGETFONT
where cGETFONT = '9.Arial'. But, the DCBROWSE keep showing me a bold and larger font.

*****************

When I write the FONT parameter as such

Code: Select all

@ nRow + IIF(lAutoSeek,1.5*IIF(lPixel,20,1),0), nCol DCBROWSE aData[1] ;
FONT {|| '9.Arial'}
the browser window will follow the specified font.
As the requirement is to allow the font change according to the database. I will need to figure out how to make the FONT parameter to use a variable (cGETFONT) instead of a constant ('9.Arial')

Any ideas?

Note: I have tried

Code: Select all

FONT {|| cGETFONT} 

Code: Select all

afonts:={}
AADD(afonts, cGETFONT)
@ nRow + IIF(lAutoSeek,1.5*IIF(lPixel,20,1),0), nCol DCBROWSE aData[1] ;
FONT {|| afonts[1]}

Both ways don't work

I'm using XBase++ 1.90.331, Express++ build 258

Andy

User avatar
Tom
Posts: 1234
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Font in DCBROWSE

#2 Post by Tom »

This works with 1.9 SL1 and the same eXpress++ you're using:

Code: Select all

#include 'dcdialog.ch'
#pragma library("dclipx.lib")

FUNCTION MAIN(cFontNo)
LOCAL GetList := {}, oBrowse, aData := {}, aFonts := {'10.Arial','12.Arial','8.Arial'}, nFontNo := 1

DEFAULT cFontNo := '1'

nFontNo := Val(cFontNo)

aData := {{'test','test','test'},{'test2','test3','test4'}}

@ 1,1 DCBROWSE oBrowse DATA aData SIZE 20,10 FONT {||aFonts[nFontNo ]} FIT

DCBROWSECOL ELEMENT 1 HEADER 'test' PARENT oBrowse WIDTH 10
DCBROWSECOL ELEMENT 2 HEADER 'test' PARENT oBrowse WIDTH 10
DCBROWSECOL ELEMENT 2 HEADER 'test' PARENT oBrowse WIDTH 10

DCREAD GUI FIT ADDBUTTONS

RETURN nil
Calling the app with a parameter like 1, 2 or 3 will show the browse with a different font.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

Wolfgang Ciriack
Posts: 484
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: Font in DCBROWSE

#3 Post by Wolfgang Ciriack »

You can also use the get/set function

Code: Select all

DC_BrowPres({ ;
   {XBP_PP_COMPOUNDNAME, myFont }, ;
   {XBP_PP_COL_DA_FGCLR, GRA_CLR_BLACK }, ;
   {XBP_PP_COL_DA_BGCLR, GRA_CLR_WHITE}, ;
   {XBP_PP_HILITE_FGCLR, GRA_CLR_BLACK }, ;
   {XBP_PP_HILITE_BGCLR, GraMakeRGBColor({255,204,153}) }, ;
   {XBP_PP_COL_DA_ROWHEIGHT, myRowPixels }, ;
   {XBP_PP_COL_DA_CELLHEIGHT, myRowPixels }, ;
   {XBP_PP_COL_HA_COMPOUNDNAME, myFont2 } ;
  })
and then for your browse

Code: Select all

@4.0,1 DCBROWSE oBrowse DATA... PRESENTATION DC_BrowPres() 
_______________________
Best Regards
Wolfgang

Andy Edward
Posts: 103
Joined: Fri Sep 17, 2010 2:58 am

Re: Font in DCBROWSE

#4 Post by Andy Edward »

Hi,

Thanks for the help. From your examples, it lead me to the problem, which was my cGETFONT content

The cGETFONT was returning '9.Arial ', which will not register with the FONT parameter.

So what I use is

Code: Select all

FONT {|| ALLTRIM(cGETFONT)}
Thanks again

Andy

Post Reply