When I recall Choosefont() I not see the font I select before
How I can to show the font I select before ?
I call with aFont := ChooseFont(,@nColorFont ) where nColorFont is the color
#include "FiveWin.ch"
function Main()
local oWnd, oFont, oBtn, oGet, nColor := 0
DEFINE DIALOG oWnd TITLE "Elegir font"
oFont:= oWnd:oFont
@ 10,10 GET oGet VAR nColor PICTURE "999999999" RIGHT of oWnd PIXEL
@ 30,10 BUTTON oBtn PROMPT "Elegir Font" ACTION ElegirFont(@oFont,@nColor) OF oWnd SIZE 30,10 PIXEL
ACTIVATE DIALOG oWnd
return nil
//----------------------------------------------------------------------------//
function ElegirFont(oFont,nColor)
oFont := ChooseFont(oFont,@nColor)
return nil
aFont := ChooseFont( { oFont:nInpHeight, oFont:nInpWidth, oFont:nEscapement,;
oFont:nOrientation, oFont:nWeight, oFont:lItalic,;
oFont:lUnderLine, oFont:lStrikeOut, oFont:nCharSet,;
oFont:nOutPrecision, oFont:nClipPrecision,;
oFont:nQuality, oFont:nPitchFamily, oFont:cFaceName },;
@nNewColor )
if !Empty( aFont[ LF_FACENAME ] )
oNewFont = TFont():New( aFont[ LF_FACENAME ],, aFont[ LF_HEIGHT ], .f.,;
! ( aFont[ LF_WEIGHT ] == FW_NORMAL ),;
aFont[ LF_ESCAPEMENT ], aFont[ LF_ORIENTATION ],;
aFont[ LF_WEIGHT ], aFont[ LF_ITALIC ],;
aFont[ LF_UNDERLINE ], aFont[ LF_STRIKEOUT ],;
aFont[ LF_CHARSET ], aFont[ LF_OUTPRECISION ],;
aFont[ LF_CLIPPRECISION ], aFont[ LF_QUALITY ],,;
aFont[ LF_PITCHANDFAMILY ] )
o:SetFormat( oNewFont, nNewColor )
Jimmy wrote:hi Silvio,
as i understand the 1st Parameter is a Array or Object of used Font
- Code: Select all Expand view
aFont := ChooseFont( { oFont:nInpHeight, oFont:nInpWidth, oFont:nEscapement,;
oFont:nOrientation, oFont:nWeight, oFont:lItalic,;
oFont:lUnderLine, oFont:lStrikeOut, oFont:nCharSet,;
oFont:nOutPrecision, oFont:nClipPrecision,;
oFont:nQuality, oFont:nPitchFamily, oFont:cFaceName },;
@nNewColor )
later we can use Array aFont to create New Font
- Code: Select all Expand view
if !Empty( aFont[ LF_FACENAME ] )
oNewFont = TFont():New( aFont[ LF_FACENAME ],, aFont[ LF_HEIGHT ], .f.,;
! ( aFont[ LF_WEIGHT ] == FW_NORMAL ),;
aFont[ LF_ESCAPEMENT ], aFont[ LF_ORIENTATION ],;
aFont[ LF_WEIGHT ], aFont[ LF_ITALIC ],;
aFont[ LF_UNDERLINE ], aFont[ LF_STRIKEOUT ],;
aFont[ LF_CHARSET ], aFont[ LF_OUTPRECISION ],;
aFont[ LF_CLIPPRECISION ], aFont[ LF_QUALITY ],,;
aFont[ LF_PITCHANDFAMILY ] )
and set new Color
- Code: Select all Expand view
o:SetFormat( oNewFont, nNewColor )
cFontName := oBrowse:aArraydata[nRecord][15]
nFontSize := oBrowse:aArraydata[nRecord][16]
lUnderline := oBrowse:aArraydata[nRecord][17]
lStrikeOut := oBrowse:aArraydata[nRecord][18]
lBold := oBrowse:aArraydata[nRecord][19]
lItalic := oBrowse:aArraydata[nRecord][20]
nColorFont := oBrowse:aArraydata[nRecord][21]
@ nRow,5 BTNBMP aGet[15] OF oRigaModulo;
PROMPT cFontName RIGHT;
SIZE 250, 23 PIXEL FLAT NOROUND
@ nRow,215 BTNBMP aGet[16] OF oRigaModulo;
PROMPT STR(nFontSize) LEFT;
SIZE 50, 23 PIXEL FLAT NOROUND
@ nRow, 255 BUTTONBMP oBtnSel[4] RESOURCE "REP_FONT" FLAT SIZE 20, 23 OF oRigaModulo PIXEL ;
ACTION (aFont := ChooseFont(aFont,@nColorFont ),;
cFontName:=aFont[LF_FACENAME],;
nFontSize:=IF( aFont[LF_HEIGHT ]!=NIL,FontHeightInPoints( aFont[LF_HEIGHT ]),0) ,;
lBold:= IIF(aFont[LF_WEIGHT]=700,.t.,.f.) ,;
lItalic:= aFont[LF_ITALIC],;
lUnderline:=aFont[LF_UNDERLINE],;
lStrikeout:=aFont[ LF_STRIKEOUT ],;
aGet[15]:settext(cFontName),;
aGet[16]:settext(str(nFontSize)),;
aGet[15]:refresh(),;
aGet[16]:refresh())
Silvio.Falconi wrote:I have the data in a browse
- Code: Select all Expand view
cFontName := oBrowse:aArraydata[nRecord][15]
nFontSize := oBrowse:aArraydata[nRecord][16]
lUnderline := oBrowse:aArraydata[nRecord][17]
lStrikeOut := oBrowse:aArraydata[nRecord][18]
lBold := oBrowse:aArraydata[nRecord][19]
lItalic := oBrowse:aArraydata[nRecord][20]
nColorFont := oBrowse:aArraydata[nRecord][21]
only in the edit i create aFont array
- Code: Select all Expand view
aFont:= { , , ,, , lItalic,lUnderline, lStrikeOut, ,, ,, , cFontName }
then in the get control i do like this
aFont := { oFont:nInpHeight, oFont:nInpWidth, oFont:nEscapement,;
oFont:nOrientation, oFont:nWeight, oFont:lItalic,;
oFont:lUnderLine, oFont:lStrikeOut, oFont:nCharSet,;
oFont:nOutPrecision, oFont:nClipPrecision,;
oFont:nQuality, oFont:nPitchFamily, oFont:cFaceName }
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 94 guests