using PUBLIC FONT in DIALOG

Post Reply
User avatar
Jimmy
Posts: 1733
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

using PUBLIC FONT in DIALOG

Post by Jimmy »

hi,

i got this in *.LOG
14.05.2023 21:03:46: MAIN( 624 ) "Start" = "Start"
14.05.2023 21:04:29: EXCESS RELEASE OF FONT TAHOMA[ hFont : 0] ( nCount : 0 )
<-TFONT:END(303) <-TCONTROL:DESTROY(2318) <-TBTNBMP:DESTROY(1111) <-TWINDOW:HANDLEEVENT(0) <-TCONTROL:HANDLEEVENT(1857) <-TBTNBMP:HANDLEEVENT(2135) <-_FWH(3681) <-WINRUN(0) <-TWINDOW:ACTIVATE(1114)
------------------------------------------------------------
14.05.2023 21:04:29: EXCESS RELEASE OF FONT TAHOMA[ hFont : 0] ( nCount : -1 )
<-TFONT:END(303) <-TCONTROL:DESTROY(2318) <-TBTNBMP:DESTROY(1111) <-TWINDOW:HANDLEEVENT(0) <-TCONTROL:HANDLEEVENT(1857) <-TBTNBMP:HANDLEEVENT(2135) <-_FWH(3681) <-WINRUN(0) <-TWINDOW:ACTIVATE(1114)
------------------------------------------------------------
14.05.2023 21:04:29: MAIN( 953 ) "Ende" = "Ende"
i have open DIALOG where i use a PUBLIC FONT in XBROWSE
when remove FONT or use a "local" FONT than i have no Problem ... hm

what is the Problem with PUBLIC FONT in DIALOG :?:

p.s. App will still run but i want get rid of those Error.LOG
greeting,
Jimmy
User avatar
cnavarro
Posts: 6552
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: using PUBLIC FONT in DIALOG

Post by cnavarro »

After ACTIVATE DIALOG

Code: Select all | Expand

   Do While oFont:nCount > 0
       oFont:End()
   Enddo
 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
nageswaragunupudi
Posts: 10691
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: using PUBLIC FONT in DIALOG

Post by nageswaragunupudi »

Jimmy wrote:hi,

i got this in *.LOG
14.05.2023 21:03:46: MAIN( 624 ) "Start" = "Start"
14.05.2023 21:04:29: EXCESS RELEASE OF FONT TAHOMA[ hFont : 0] ( nCount : 0 )
<-TFONT:END(303) <-TCONTROL:DESTROY(2318) <-TBTNBMP:DESTROY(1111) <-TWINDOW:HANDLEEVENT(0) <-TCONTROL:HANDLEEVENT(1857) <-TBTNBMP:HANDLEEVENT(2135) <-_FWH(3681) <-WINRUN(0) <-TWINDOW:ACTIVATE(1114)
------------------------------------------------------------
14.05.2023 21:04:29: EXCESS RELEASE OF FONT TAHOMA[ hFont : 0] ( nCount : -1 )
<-TFONT:END(303) <-TCONTROL:DESTROY(2318) <-TBTNBMP:DESTROY(1111) <-TWINDOW:HANDLEEVENT(0) <-TCONTROL:HANDLEEVENT(1857) <-TBTNBMP:HANDLEEVENT(2135) <-_FWH(3681) <-WINRUN(0) <-TWINDOW:ACTIVATE(1114)
------------------------------------------------------------
14.05.2023 21:04:29: MAIN( 953 ) "Ende" = "Ende"
i have open DIALOG where i use a PUBLIC FONT in XBROWSE
when remove FONT or use a "local" FONT than i have no Problem ... hm

what is the Problem with PUBLIC FONT in DIALOG :?:

p.s. App will still run but i want get rid of those Error.LOG
Impossible, unless there is a deviation in the program code from the recommended usage or creation and release of fonts.
It does not matter whether the font is Public, Private, Local or Static variable
In a well written program, there should never be a need for workarounds like:

Code: Select all | Expand

Do While oFont:nCount > 0
       oFont:End()
   Enddo
Can anyone please provide a small sample to reproduce this problem?

I tested in several ways and never got this problem.
This is one of my tests:

Code: Select all | Expand

#include "fivewin.ch"

MEMVAR oFontP

function MaIN()

   local oWnd, oBar

   PUBLIC oFontP

   DEFINE FONT oFontP NAME "VERDANA" SIZE 0,-14

   DEFINE WINDOW oWnd
   oWnd:SetFont( oFontP )
   DEFINE BUTTONBAR oBar OF oWnd
   DEFINE BUTTON OF oBar ACTION ShowDlg()

   ACTIVATE WINDOW oWnd

   RELEASE FONT oFontP

return nil

static function ShowDlg()

   local oDlg, oBrw

   DEFINE DIALOG oDlg SIZE 400,200 PIXEL TRUEPIXEL FONT oFontP
   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE { 1,2,3 } AUTOCOLS ;
      FONT oFontP ;
      CELL LINES NOBORDER

   oBrw:CreateFromCode()

   ACTIVATE DIALOG oDlg

return nil
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
Jimmy
Posts: 1733
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: using PUBLIC FONT in DIALOG

Post by Jimmy »

hi,

i have figure out that "Problem" was in MENU which called DIALOG :roll:

for MENUITEM i want a FONT so i use

Code: Select all | Expand

   oMenu:oFont := oFontDefault
but when close PopUp-Menu it will destroy FONT assign to oMenu:oFont

so i need to define a own FONT for MENUITEM

Code: Select all | Expand

   DEFINE FONT oFontMenu NAME "Lucida Console" SIZE 0, - SP_nFontSize()
      ACTIVATE FONT oFontMenu
   END FONT
   oMenu:oFont := oFontMenu
now it work without Error :D

sorry for my Mistake
greeting,
Jimmy
Post Reply