FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour BUG: FONTS NOT RELEASED IN LATEST FWH
Posts: 838
Joined: Wed Aug 22, 2007 10:09 AM
BUG: FONTS NOT RELEASED IN LATEST FWH
Posted: Fri Dec 20, 2019 05:37 PM

Hi,

Those fonts are not released:

-- FONT,-1710615546,TWINDOW:GETFONT(2995)->TWINDOW:NEW(960)->MAIN(657)

-- BRUSH,152049635,TRPANEL:REGISTER(779)->TRPANEL:NEW(50)->TRIBBONBAR:NEW(314)->MAIN(664)

-- FONT,-1811279512,TRICHEDIT:REDEFINE(403)->ALTASCLIENTE(1527)->->TXBROWSE:LDBLCLICK(5071)->TWINDOW:HANDLEEVENT(0)->TCONTROL:HANDLEEVENT(1801)->TXBROWSE:HANDLEEVENT(11221)->_FWH(3559)->DIALOGBOXINDIRECT(0)->TDIALOG:ACTIVATE(304)->VERCLIENTES(2036)->(b)MAIN(685)->TRBTN:CLICK(717)->TRBTN:LBUTTONUP(917)->TCONTROL:HANDLEEVENT(1791)->TRBTN:HANDLEEVENT(1575)->_FWH(3559)->WINRUN(0)->TWINDOW:ACTIVATE(1097)->MAIN(761)

====================================================================================================

Thank you.

Saludos / Regards,



FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: BUG: FONTS NOT RELEASED IN LATEST FWH
Posted: Sat Dec 21, 2019 05:33 PM

At the end of your app
Release ofontname

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 838
Joined: Wed Aug 22, 2007 10:09 AM
Re: BUG: FONTS NOT RELEASED IN LATEST FWH
Posted: Sun Dec 22, 2019 09:48 AM

Silvio,

I haven't defined any font, these are Fivewin's internal fonts.

Saludos / Regards,



FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: BUG: FONTS NOT RELEASED IN LATEST FWH
Posted: Sun Dec 22, 2019 10:05 AM
MOISES wrote:Silvio,

I haven't defined any font, these are Fivewin's internal fonts.


I do not get any message of resources not destroyed in any of my applications (for example FivEdit uses more than 20 fonts in the different controls).
It is usually an incorrect assignment of the font, for example (:: oFont: = oFont1, instead of using its method :: SetFont (oFont1))
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
Posts: 838
Joined: Wed Aug 22, 2007 10:09 AM
Re: BUG: FONTS NOT RELEASED IN LATEST FWH
Posted: Sun Dec 22, 2019 11:00 AM

Crist贸bal,

Can you please try to use a Ribbon and a RICHEDIT control?

I don麓t define fonts, so it is an internal issue of Fivewin.

Thank you.

Saludos / Regards,



FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: BUG: FONTS NOT RELEASED IN LATEST FWH
Posted: Sun Dec 22, 2019 11:24 AM

It is possible that there is some control in which this problem occurs. Can you give a simple example to check?

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
Posts: 838
Joined: Wed Aug 22, 2007 10:09 AM
Re: BUG: FONTS NOT RELEASED IN LATEST FWH
Posted: Sun Dec 22, 2019 06:43 PM
Sure.

This is a RTF sample:

Code (fw): Select all Collapse
#Include "FiveWin.ch"
#include "richedit.ch"

//----------------------------------------------------------------------------//

Function Main()

   Local oDlg, oRich, cRtf := ""
   Local hRichDLL := LoadLibrary( "riched20.dll" )

   local lBold := .F., nPos := 0




   // Debug Checkres
   FErase("checkres.txt")
   SetResDebug( .T. )




   cRtf:="{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Courier New;}}"+CRLF+;
            "{\colortbl ;\red0\green77\blue187;\red192\green80\blue77;}"+CRLF+;
            "{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\cf1\lang1031\f0\fs22 This is \b colored \b0 text\cf0 . \cf2 The background is color 1 and the foreground is color 2\cf0\par"+CRLF+CRLF+;
            "}"




   DEFINE DIALOG oDlg NAME "Test"




   REDEFINE RICHEDIT oRich VAR cRTF  OF oDlg  ID 100

   //oRich:lHighLight = .f.



   REDEFINE BUTTON ID 110 ACTION ( oRich:LoadFromRTFFile( cGetFile( "Archivo RTF (*.rtf) | *.rtf" ), oRich:SetFocus() ) )



   REDEFINE BUTTON ID 120  ACTION ( lBold := ! lBold, ;
                                    oRich:SetBold( lBold ), oDlg:Update(), oRich:SetFocus(), oDlg:cTitle := "IsBold "+cValtoChar(lBold) )


   oRich:SetText( cRtf )

   //oRich:bGotFocus = { || oRich:HideSel(), oRich:SetSel( nPos, nPos ) }
   //oRich:bLostFocus = { || nPos := oRich:GetPos() }


   ACTIVATE DIALOG oDlg CENTERED

   FreeLibrary( hRichDLL )



   /* CheckRes Recursos FWH*/
   CheckRes()
   WinExec("notepad checkres")



Return nil



Bug at: TRICHEDIT:REDEFINE(403)-

You have an unreleased Font, defined in both new and redefine methods.

Thank you.
Saludos / Regards,



FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: BUG: FONTS NOT RELEASED IN LATEST FWH
Posted: Sun Dec 22, 2019 07:21 PM

Please send me .rc file, thanks

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
Posts: 838
Joined: Wed Aug 22, 2007 10:09 AM
Re: BUG: FONTS NOT RELEASED IN LATEST FWH
Posted: Mon Dec 23, 2019 08:32 AM
Sure, here is:

Code (fw): Select all Collapse
#include <windows.h>

#define IDC_EDIT1   101

Test DIALOG 41, 64, 409, 199
STYLE DS_MODALFRAME | 0x4L | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Testing the RichEdit control"
FONT 8, "MS Sans Serif"
{
 CONTROL "", 100, "RichEdit20A", 4100 | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 6, 12, 398, 163
 PUSHBUTTON "&Load text file", 110, 5, 179, 50, 16
 PUSHBUTTON "&Bold", 120, 95, 179, 50, 16

}


Thank you.
Saludos / Regards,



FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: BUG: FONTS NOT RELEASED IN LATEST FWH
Posted: Mon Dec 23, 2019 10:31 AM
Moises, thanks, you are right
Please modify METHOD Redefine in TRichEdit CLASS
Code (fw): Select all Collapse
//----------------------------------------------------------------------------//

METHOD ReDefine( nId, bSetGet, oWnd, nHelpId, oFont, cMsg, lReadOnly, ;
                 lHighlight, cFileName, nRTFSize, lNoURL, bWhen, bValid, ;
                 bChanged ) CLASS TRichEdit

   DEFAULT lReadOnly  := .f., ;
           lHighlight := .f., ;
           cFileName  := "" , ;
           nRTFSize   := 1024 * 1024, ;
           lNoURL     := .f., ;
           oWnd       := GetWndDefault()

   ::nId       = nId
   ::bSetGet   = bSetGet
   ::uOriginalValue = Eval( ::bSetGet )
   ::oWnd      = oWnd
   ::nHelpId   = nHelpId
   ::cMsg      = cMsg
   ::bWhen     = bWhen
   ::bValid    = bValid
   ::lReadOnly = lReadOnly
   ::bChange   = bChanged
   ::cFileName = cFileName
   ::nRTFSize  = Max( nRTFSize, 32 * 1024 )
   ::lURL      = !lNoURL

   ::lHighlight  = lHighlight
   ::aKeywords1  = { "CLASS", "FROM", "ENDCLASS", "DATA", "AS", "METHOD",;
                    "CONSTRUCTOR", "function", "return", "OBJECT", "ENDOBJECT" }
   ::aKeywords2  = { "#include", "Self", "nil", "public", "local", "Super" }
   ::cSeparators = " +-()[]:*/{},="

   ::nClrNumber    = CLR_HMAGENTA
   ::nClrString    = CLR_YELLOW
   ::nClrComment   = CLR_HBLUE
   ::nClrSeparator = CLR_WHITE
   ::nClrText      = CLR_BLACK
   ::nClrKey1      = CLR_HGREEN
   ::nClrKey2      = CLR_HCYAN

   if oFont == nil
      DEFINE FONT ::oFont NAME "ARIAL" SIZE 0,If( LargeFonts(), -11, -13 )
   else
      ::SetFont( oFont )
   endif

   ::SetOleInit()

   //::Register( nOr( CS_VREDRAW, CS_HREDRAW, CS_DBLCLKS ) )
   oWnd:DefControl( Self )

return Self

//----------------------------------------------------------------------------//


and in CLASS TRICHEDIT5 ( fwh\source\classes\triched5.prg )

Code (fw): Select all Collapse
METHOD ReDefine( nId, bSetGet, oWnd, nHelpId, oFont, cMsg, lReadOnly, ;
                 lHighlight, cFileName, nRTFSize, lNoURL, bWhen, bValid, ;
                 bChanged, nLeftMargin, lNew ) CLASS TRichEdit5

   local   cDll
   DEFAULT lReadOnly  := .f., ;
           lHighlight := .f., ;
           cFileName  := "" , ;
           nRTFSize   := 1024 * 1024, ;
           lNoURL     := .f., ;
           oWnd       := GetWndDefault(), ;
           nLeftMargin := 0//, ;
           lNew        := .T.

   ::lUnicode  := FW_SetUnicode()
   ::nId       := nId
   ::bSetGet   := bSetGet
   ::uOriginalValue = Eval( ::bSetGet )
   ::oWnd      := oWnd
   ::nHelpId   := nHelpId
   ::cMsg      := cMsg
   ::bWhen     := bWhen
   ::bValid    := bValid
   ::lReadOnly := lReadOnly
   ::bChange   := bChanged
   ::cFileName := cFileName
   ::nRTFSize  := Max( nRTFSize, 32 * 1024 )
   ::lURL      := !lNoURL
   ::lCaptured := .f.
   if lNew
      ::cCtrl_Class   := "RichEdit50W"
      cDll            := "Msftedit.dll"
   else
      ::cCtrl_Class   := "RichEdit20A"
      cDll            := "RichEd20.dll"
   endif
   if ::nInst == 0
      ::hLib := LoadLibrary( cDll )
   endif
   ::nInst ++
   if bSetGet  != nil
      ::cCaption := cValToChar( Eval( bSetGet ) )
   else
      ::cCaption := ""
   endif

   ::lHighlight  := lHighlight
   ::aKeyWords1  := {}
   ::aKeyWords1  := {}
   ::cSeparators := ""
   ::aCharFormat := {}   // Array( 14 )

   ::nClrNumber    := CLR_HMAGENTA
   ::nClrString    := CLR_YELLOW
   ::nClrComment   := CLR_HBLUE
   ::nClrSeparator := CLR_WHITE
   ::nClrText      := CLR_BLACK
   ::nClrKey1      := CLR_HGREEN
   ::nClrKey2      := CLR_HCYAN
   ::nClrProtect   := CLR_HRED
   ::nMarginLeft   := nLeftMargin

   if oFont == nil
      DEFINE FONT ::oFont NAME "ARIAL" SIZE 0,If( LargeFonts(), -11, -13 )
   else
      ::SetFont( oFont )
   endif

   ::aTableFormat  := Array( 7 )
   ::aPos          := { 0, 0 }
   ::aOldPos       := { 0, 0 }

   ::SetOleInit()
   ::Default()
   ::SendMsg( WM_SETFONT, ::oFont:hFont, 0 )
   oWnd:DefControl( Self )

   ::SetFont2RTF( ::oFont:nHeight )  // to adjust point size

   if ::lHighlight
      ::HighLightAllText() // PostMessage( ::hWnd, FM_HIGHLIGHTALL )
   endif

   if !Empty( ::nMarginLeft )
      ::SetMargin()
   endif

return Self

//----------------------------------------------------------------------------//


I recommend that you use the new TRICHEDIT5 class
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

Continue the discussion