Bug in font management? [Solved]

Post Reply
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Bug in font management? [Solved]

Post by Enrico Maria Giordano »

In the sample below, uncommenting the first PROMPT clause the font is reverted to the default one:

Code: Select all

#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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Bug in font management?

Post by Antonio Linares »

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Bug in font management?

Post by Antonio Linares »

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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Bug in font management?

Post by Enrico Maria Giordano »

Antonio,
Antonio Linares wrote: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 :-)
I found two occurrences:

Code: Select all

hOldFont = SelectObject( ::hDC, If( ::lBarBtn, If( ::oWnd:oFont != nil, ::oWnd:oFont:hFont, ::oFont:hFont ), ::oFont:hFont ) )
and

Code: Select all

hOldFont = SelectObject( ::hDC, ::oFont:hFont ) // If( ::lBarBtn, ::oWnd:oWnd:oFont:hFont, ::oFont:hFont ) )
Do I have to change the first as it will look like the second?

Please confirm.

EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Bug in font management?

Post by Antonio Linares »

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
Post Reply