Page 1 of 1

Font in DCBROWSE

Posted: Wed Feb 12, 2014 2:50 am
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

Re: Font in DCBROWSE

Posted: Wed Feb 12, 2014 4:17 am
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.

Re: Font in DCBROWSE

Posted: Wed Feb 12, 2014 10:15 am
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() 

Re: Font in DCBROWSE

Posted: Wed Feb 12, 2014 7:33 pm
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