FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour A font-problem in METRO-app ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
A font-problem in METRO-app ?
Posted: Fri Apr 08, 2016 09:06 PM
Hello,

I have a problem with fonts in my METRO-aplication

Fonts defined on top

DEFINE FONT oFontLarge NAME "Arial" SIZE 0, -50 BOLD ITALIC
DEFINE FONT oFontTime NAME "Arial" SIZE 0, -25 BOLD ITALIC
DEFINE FONT oFontMed NAME "Arial" SIZE 0, -20 BOLD
DEFINE FONT oFontTiny NAME "Arial" SIZE 0, -15
DEFINE FONT oFontSys NAME "Arial" SIZE 0, -14
DEFINE FONT oFontText NAME "Arial" SIZE 0, -13
DEFINE FONT oFontTage NAME "Arial" SIZE 0, -11
IF nScreenW > 1600
DEFINE FONT oTileFont NAME "Arial" SIZE 0, -20 BOLD
ELSE
DEFINE FONT oTileFont NAME "Arial" SIZE 0, -16 BOLD
ENDIF


released at the end

oFontLarge:End() // Line 179
oFontTime:End()
oFontMed:End()
oFontTiny:End()
oFontSys:End()
oFontText:End()
oFontTage:End()
oTileFont:End() // Line 186


My 1. test NO buttons only the headline
My 2. test with 1 button

I 'm getting the following messages iside the LOG file

From the 1. test
08.04.2016 22:55:31: EXCESS RELEASE OF FONT Arial[ hFont : 0] ( nCount : 0 )
<-TFONT:END(284) <-MAIN(179)
------------------------------------------------------------
from the 2. test
08.04.2016 22:58:34: EXCESS RELEASE OF FONT Arial[ hFont : 0] ( nCount : 0 )
<-TFONT:END(284) <-MAIN(186)
------------------------------------------------------------


adding ALL buttons the log-file looks like

08.04.2016 23:15:26: EXCESS RELEASE OF FONT Arial[ hFont : 0] ( nCount : 0 )
<-TFONT:END(284) <-TCONTROL:DESTROY(2122) <-TBTNBMP:DESTROY(912) <-TMETROBTN:DESTROY(900)
<-TWINDOW:HANDLEEVENT(0) <-TCONTROL:HANDLEEVENT(1733)
<-TMETROBTN:HANDLEEVENT(1766) <-_FWH(3278) <-WINRUN(0)
------------------------------------------------------------
08.04.2016 23:15:26: EXCESS RELEASE OF FONT Arial[ hFont : 0] ( nCount : -1 )
<-TFONT:END(284) <-TCONTROL:DESTROY(2122) <-TBTNBMP:DESTROY(912) <-TMETROBTN:DESTROY(900)
<-TWINDOW:HANDLEEVENT(0) <-TCONTROL:HANDLEEVENT(1733)
<-TMETROBTN:HANDLEEVENT(1766) <-_FWH(3278) <-WINRUN(0)
------------------------------------------------------------
08.04.2016 23:15:26: EXCESS RELEASE OF FONT Arial[ hFont : 0] ( nCount : -2 )
<-TFONT:END(284) <-TCONTROL:DESTROY(2122) <-TBTNBMP:DESTROY(912) <-TMETROBTN:DESTROY(900)
<-TWINDOW:HANDLEEVENT(0) <-TCONTROL:HANDLEEVENT(1733)
<-TMETROBTN:HANDLEEVENT(1766) <-_FWH(3278) <-WINRUN(0)
------------------------------------------------------------
08.04.2016 23:15:26: EXCESS RELEASE OF FONT Arial[ hFont : 0] ( nCount : -3 )
<-TFONT:END(284) <-TCONTROL:DESTROY(2122) <-TBTNBMP:DESTROY(912) <-TMETROBTN:DESTROY(900)
<-TWINDOW:HANDLEEVENT(0) <-TCONTROL:HANDLEEVENT(1733)
<-TMETROBTN:HANDLEEVENT(1766) <-_FWH(3278) <-WINRUN(0)
------------------------------------------------------------
08.04.2016 23:15:26: EXCESS RELEASE OF FONT Arial[ hFont : 0] ( nCount : -4 )
<-TFONT:END(284) <-TCONTROL:DESTROY(2122) <-TBTNBMP:DESTROY(912) <-TMETROBTN:DESTROY(900)
<-TWINDOW:HANDLEEVENT(0) <-TCONTROL:HANDLEEVENT(1733)
<-TMETROBTN:HANDLEEVENT(1766) <-_FWH(3278) <-WINRUN(0)
...
...
48 times the same

fonts are defined on top and released at the end
Why these errors ?

the typical button

DEFINE METROBUTTON oSBtn[105] OF oMetro ;
COLOR CLR_WHITE, 255 ;
CAPTION "&Ende" ;
ALIGN "BOTTOMLEFT" ;
GROUP 3 ;
FONT oTileFont ;
BITMAP c_Pfad1 + "exit.bmp" ;
BMPALIGN "BOTTOMRIGHT" ;
SIZE 48, 48 ;
BODYTEXT "Pflegeplus; beenden" ;
TEXTALIGN "TOPLEFT" ;
ACTION oWnd:End()
oSBtn[105]:nClrCaption := CLR_WHITE
oSBtn[105]:oFont := oTileFont
oSBtn[105]:oTextFont := oTileFont

best regards
Uwe :-)
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.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: A font-problem in METRO-app ?
Posted: Fri Apr 08, 2016 10:54 PM

I suggest you do not directly assign fonts to each button. Instead please assign fonts to the metro panel like this:

oPanel:oBtnFont:End()
oPanel:oBtnFont := oNewFontForBtnCaption

oPanel:oTextFont:End()
oPanel:oTextFont := oNewFontForBtnText

You do not destroy your fonts because oPanel destroys these new fonts when ends.

Regards



G. N. Rao.

Hyderabad, India
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: A font-problem in METRO-app ?
Posted: Sat Apr 09, 2016 10:34 AM
I tested but got funny results
the LOG-file messages are fixed.

activating : oPanel1:oFont, Title and buttons are using the same font
oPanel1:oBtnFont and oPanel1:oTextFont are not shown

I used :
Code (fw): Select all Collapse
// my defined fonts
// ------------------
//DEFINE FONT oFontLarge NAME "Arial" SIZE 0, -50 BOLD
//DEFINE FONT oFontSmall NAME "Arial" SIZE 0, -16 BOLD
//DEFINE FONT oFontTiny NAME "Arial" SIZE 0, -12 BOLD

oPanel1:oFont:End()
oPanel1:oFont       := oFontLarge   // Title
oPanel1:oBtnFont:End()
oPanel1:oBtnFont        := oFontTiny    // Button
oPanel1:oTextFont:End()
oPanel1:oTextFont       := oFontSmall   // Button

//   defined in  METHOD New(.....
// ------------------------------------------
//   DEFINE FONT ::oFont  NAME "Segoe UI Light" SIZE 0, -18 BOLD
//   DEFINE FONT ::oFontB NAME "Segoe UI Light" SIZE 0, -14 BOLD
//   DEFINE FONT ::oBtnFont  NAME "Segoe UI Light" SIZE 0, -8 BOLD
//   DEFINE FONT ::oTextFont NAME "Segoe UI Light" SIZE 0, -8 BOLD


regards
Uwe :-)
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.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: A font-problem in METRO-app ?
Posted: Sat Apr 09, 2016 10:38 AM

Ok. Now font destruction issues are resolved.
May I know what other problems you have and what assistance I can provide?

Regards



G. N. Rao.

Hyderabad, India
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: A font-problem in METRO-app ?
Posted: Sat Apr 09, 2016 10:43 AM
It seems the fonts are not used :

oPanel1:End()
oPanel1:oFont := oFontLarge // Title



oPanel1:End()
oPanel1:oBtnFont := oFontTiny // Button
oPanel1:oTextFont:End()
oPanel1:oTextFont // Button



a typical defined button

DEFINE METROBUTTON oSBtn[1] OF oPanel1 ;
COLOR nMText1A, nMColor1 ;
CAPTION "&Patienten" ;
ALIGN "TOPCENTER" ;
GROUP 1 ;
BITMAP c_Pfad1 + "Patient.bmp" ;
BMPALIGN "MIDDLECENTER" ;
SIZE 50, 50 ;
ACTION ( NEU_DBF1(), P_INDEX() ) ;
BODYTEXT "Daten" ;
TEXTALIGN "BOTTOMLEFT"
oSBtn[1]:nClrCaption := nMText1B

regards
Uwe :-)
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.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: A font-problem in METRO-app ?
Posted: Sat Apr 09, 2016 11:54 AM
Please do these assignments
Code (fw): Select all Collapse
oPanel1:oFont:End()
oPanel1:oFont       := oFontLarge   // Title
oPanel1:oBtnFont:End()
oPanel1:oBtnFont        := oFontTiny    // Button
oPanel1:oTextFont:End()
oPanel1:oTextFont       := oFontSmall   // Button

before creating any button and do not assign any fonts to the buttons.
Regards



G. N. Rao.

Hyderabad, India
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: A font-problem in METRO-app ?
Posted: Sat Apr 09, 2016 02:48 PM
to be sure, nothing strange is included
I added the fonts to sample < metrptst.prg > with the same results
title and buttonfonts are the same



from original sample :

function Main( cParam )
local oWnd, oBar, oMetro, oBrush
local cTitle := "Start"

SET DATE ITALIAN
SET CENTURY ON

// added
DEFINE FONT oFontLarge NAME "Arial" SIZE 0, -50 BOLD
DEFINE FONT oFontSmall NAME "Arial" SIZE 0, -16 BOLD
DEFINE FONT oFontTiny NAME "Arial" SIZE 0, -12 BOLD

...
...

static function MakeMetroPanel( oWnd )
local oMetro, oBtn

DEFINE METROPANEL oMetro OF oWnd TITLE "Start" ;
COLOR CLR_WHITE, CLR_GREEN ;
ON CLICK oWnd:End()

oMetro:lDesignMode := .t.

// added
oMetro:End()
oMetro:oFont := oFontLarge // Title
oMetro:End()
oMetro:oBtnFont := oFontTiny // Button
oMetro:oTextFont:End()
oMetro:oTextFont := oFontSmall // Button


// the buttons :
DEFINE METROBUTTON oBtn OF oMetro ;
....
....
....
any idea what could be wrong ?

----------------
----------------

it works using ( NO logfile-writings ) adding 2 lines :

FONT oFontSmall ;
TEXTFONT oFontTiny ;



// keeping :
oPanel1:oFont := oFontLarge // Title

// not needed !!!
//oPanel1:End()
//oPanel1:oBtnFont := oFontTiny // Button
//oPanel1:oTextFont:End()
//oPanel1:oTextFont := oFontSmall // Button

DEFINE METROBUTTON oBtn OF oMetro ;
COLOR CLR_HBLUE,CLR_WHITE ;
FONT oFontSmall ;
CAPTION "Metro" ;
ALIGN "MIDDLECENTER" ;
BITMAP "..\bitmaps\fivetech3.bmp" ;
BMPALIGN "BOTTOMLEFT" ;
SIZE 50, 50 ;
BODYTEXT "FiveWin Power" ;
TEXTALIGN "BOTTOMRIGHT" ;
TEXTFONT oFontTiny ;
BACKGROUND "..\bitmaps\fiveback.bmp" ;
LARGE
oBtn:nClrCaption := CLR_HRED

regards
Uwe :-)
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.

Continue the discussion