FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index Bugs report & fixes / Informe de errores y arreglos Bug in font management? [Solved]
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Bug in font management? [Solved]

Posted: Wed Jul 09, 2014 05:32 PM
In the sample below, uncommenting the first PROMPT clause the font is reverted to the default one:

Code (fw): Select all Collapse
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg, oFnt

    DEFINE FONT oFnt NAME "Arial" SIZE 0, -9

    DEFINE DIALOG oDlg

    ACTIVATE DIALOG oDlg;
             ON INIT TOOLBAR( oDlg, oFnt );
             CENTER

    RELEASE FONT oFnt

    RETURN NIL


STATIC FUNCTION TOOLBAR( oDlg, oFnt )

    DEFINE BUTTONBAR OF oDlg SIZE 40, 40 2007

    DEFINE BUTTON OF oDlg:oBar;
//           PROMPT "Test"

    DEFINE BUTTON OF oDlg:oBar;
           PROMPT "Test";
           FONT oFnt

    RETURN NIL


EMG
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Bug in font management?

Posted: Thu Jul 10, 2014 02:22 AM

Enrico,

I think it is not a font bug but a TbtnBmp bug. As there is a prompt in the first button, a default font is created, and then on the next button the new used font is not taken into account.

I need to finish the new Class TBtnBmp Method Paint (I am reorganizing it) and it will be much easier to solve it.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Bug in font management?

Posted: Thu Jul 10, 2014 04:19 AM

Enrico,

Please look for hOldFont in Class TBtnBmp where it is assigned and change it this way:

     hOldFont = SelectObject( ::hDC, ::oFont:hFont )

That solves it :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: Bug in font management?

Posted: Thu Jul 10, 2014 07:50 AM

Antonio,

thank you. I will wait for the full btnbmp bugfix.

EMG

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: Bug in font management?

Posted: Thu Jul 10, 2014 09:00 AM
Antonio,

Antonio Linares wrote:Enrico,

Please look for hOldFont in Class TBtnBmp where it is assigned and change it this way:

hOldFont = SelectObject( ::hDC, ::hFont )

That solves it :-)


I found two occurrences:

Code (fw): Select all Collapse
hOldFont = SelectObject( ::hDC, If( ::lBarBtn, If( ::oWnd:oFont != nil, ::oWnd:oFont:hFont, ::oFont:hFont ), ::oFont:hFont ) )


and

Code (fw): Select all Collapse
hOldFont = SelectObject( ::hDC, ::oFont:hFont ) // If( ::lBarBtn, ::hFont, ::hFont ) )


Do I have to change the first as it will look like the second?

Please confirm.

EMG
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: Bug in font management?

Posted: Thu Jul 10, 2014 09:03 AM

I forgot to mention that I'm using the old btnbmp.

EMG

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Bug in font management?

Posted: Thu Jul 10, 2014 01:27 PM

Enrico,

I have emailed you the most recent version of the Class TBtnBmp, with the new Method Paint(), properly structured :-)

Have you received it ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Continue the discussion