Hi,
Is possible to change font and size for ALL Dialogs defined as RESOURCE in runtime for ALL?.
Thanks,
STATIC oGet1, oGet2, oGet3, oGet4, oSay1, oSay2, oSay3
...
...
@ 170, 240 BTNBMP oBtn1 OF oDlg 2007 ; // Change Font of SAYs and GETs
SIZE 60 , 30 PROMPT "Font" ;
FONT oGetFont ;
LEFT ;
NOBORDER ;
FILENAME "Tools.bmp" ;
ACTION MsgAlert( ReadVar() )
oBtn1:lTransparent := .T.
oBtn1:cTooltip := "Change Font"
oBtn1:lBorder := .F.
...
...
// ----------------
FUNCTION ReadVar()
LOCAL nObj := GetAllWin()
LOCAL oNewFont := TFont():New("Arial", ,-18,.F.,.T. , , , ,.T. )
// "TWINDOW", "TDIALOG"
I := 1
FOR I := 1 TO LEN(nObj)
* msgalert( Upper( nObj[I]:ClassName() ) ) // Shows Classname
IF Upper( nObj[I]:ClassName() ) == "TGET" .or. ;
Upper( nObj[I]:ClassName() ) == "TSAY"
nObj[I]:SetFont( oNewFont )
nObj[I]:Refresh()
ENDIF
NEXT
oNewFont:End()
RETURN NIL
if file(cFoPath+'IMAGE\FONT.INI')
oTxtFile := TTxtFile():New(cFoPath+'IMAGE\FONT.INI')
nLines := oTxtFile:RecCount()
for n := 1 to nlines
cLines := oTxtFile:ReadLine()
if n = 6 .or. n = 7 .or. n = 8
aadd( aFonts , if(cLines='.T.',.T.,.F.) )
elseif n = 14
aadd( aFonts , cLines )
else
aadd( aFonts , val(cLines) )
end
oTxtFile:Skip()
next
oTxtFile:Close()
end
if empty( aFonts )
aFonts := { -13, 0, 0, 0, 400, .F., .F., .F., 222, 3, 2, 1, 34, 'Tahoma' }
end
DEFINE FONT oFont NAME cFont SIZE 0,nSize
oFont:hFont := CreateFont( aFonts )
....
REDEFINE SBUTTON oBtn[3] ID 13 ;
RESOURCE 'FONTS' ;
PROMPT TE('เลือก'+CRLF+'ฟ้อนท์','Choose'+CRLF+'Font') ;
ACTION (ChooseSysFont(@aFonts)) ;
COLOR {|oBtn| If( oBtn:lMouseOver, CLR_YELLOW, CLR_WHITE ) } ;
TEXT ON_RIGHT
ACTIVATE DIALOG oDlg CENTER RESIZE16 // ON INIT (oDlg:Move( MEMVAR->TopWin,MEMVAR->LeftWin+rDlg:nWidth+1))
if lSave
oDbf:Save()
if !empty(aFonts)
hText := Fcreate(MEMVAR->cFoPath+'IMAGE\FONT.INI')
for n := 1 to len(aFonts)
Fwrite(hText,utrim(aFonts[n])+CRLF)
next
Fclose(hText)
end
end
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: cmsoft and 84 guests