change font to ALL dialogs

change font to ALL dialogs

Postby mgsoft » Thu Apr 22, 2010 11:34 am

Hi,

Is possible to change font and size for ALL Dialogs defined as RESOURCE in runtime for ALL?.

Thanks,

:D
Saludos,

Eduardo
User avatar
mgsoft
 
Posts: 422
Joined: Mon Aug 17, 2009 12:18 pm
Location: España

Re: change font to ALL dialogs

Postby mgsoft » Sat May 29, 2010 9:07 pm

Any clue?
Saludos,

Eduardo
User avatar
mgsoft
 
Posts: 422
Joined: Mon Aug 17, 2009 12:18 pm
Location: España

Re: change font to ALL dialogs

Postby ukoenig » Sun May 30, 2010 8:54 am

Changing Font of all Gets- and Says :

Also see :
viewtopic.php?f=3&t=18940

Image

Code: Select all  Expand view

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
 


Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: change font to ALL dialogs

Postby mgsoft » Wed Jun 09, 2010 1:00 pm

Hi,

Thanks but I can´t apply that.

I need to create bigger Dialogs when the Screen resolution is higher.

So at the start of my application I define a FONT accorting to the screen and all the dialogs should use that font.

Regards :D
Saludos,

Eduardo
User avatar
mgsoft
 
Posts: 422
Joined: Mon Aug 17, 2009 12:18 pm
Location: España

Re: change font to ALL dialogs

Postby dutch » Thu Jun 10, 2010 6:23 am

Hi,

I use in my program as your mention.

I have a screen to define font and save in .ini file and then read at start of the program.

Code: Select all  Expand view
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 
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: cmsoft and 84 guests