Button labels changing font size

Button labels changing font size

Postby TimStone » Fri May 18, 2012 3:43 pm

I encountered a strange problem with FWH 12.04 that does not exist in previous versions.

On my main( ) program, I create a window with a button bar ( oBar ). When I open a dialog, I will hide() the bar. When I return from the dialog, I again show( ) the bar.

With the release of 12.04, I noticed that the font size changes when I retrieve the bar, and it is larger. I went back to older versions of my software and this clearly does not exist.

Any thoughts on this, and an idea on how to resolve it ?

Thanks.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Button labels changing font size

Postby TimStone » Mon May 21, 2012 3:30 pm

Has anyone else seen this occur in 12.04 ?
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Button labels changing font size

Postby Enrico Maria Giordano » Mon May 21, 2012 4:40 pm

Can you post a little sample showing the problem?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Button labels changing font size

Postby TimStone » Mon May 21, 2012 4:51 pm

Actually, no. It doesn't lend itself to that.

The steps are:

1) In the Main( ) window, a button bar is created, called oReBar. Buttons are added to it.
2) When a dialog is ACTIVATEd, ON INIT includes oReBar:Hide( ).
3) When a dialog is closed, oReBar:Show( ) is issued.
4) In past versions, the bar was displayed and the label font never changed
5) With 12.04, when the Show( ) is issued, the bar returns, but with a larger font.
6) This is consistent with ALL dialog calls.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Button labels changing font size

Postby ukoenig » Mon May 21, 2012 5:50 pm

Hello Tim,

I couldn't detect any problem :

Image

Code: Select all  Expand view

#include "FiveWin.ch"

static oWnd, cPath, oBar, oBrush, oCursorHand

FUNCTION Main()
LOCAL hDCo, oButt1, oButt2, oButt3, oButt4, oButt5, oButt6
LOCAL oButtFont1, oButtFont2, oButtFont3

c_path := GETCURDIR()  
oButtFont1 := TFont():New("Arial",,-18,.F.,.F.,,,,.F.)
oButtFont2 := TFont():New("Arial",,-18,.F.,.T.,,,,.F.)
oButtFont3 := TFont():New("Arial",,-18,.F.,.T.,,,,.T.)

DEFINE CURSOR oCursorHand HAND
SetBalloon( .T. )

// Color
// -------
DEFINE BRUSH oBrush  COLOR 14853684

DEFINE WINDOW oWnd TITLE "Testing Buttonbar"  ;
MENU TMenu():New() BRUSH oBrush

DEFINE BUTTONBAR oBar OF oWnd SIZE 100,80 3DLOOK 2007 TOP
// 1) In the Main( ) window, a button bar is created, called oReBar. Buttons are added to it.
// 2) When a dialog is ACTIVATEd, ON INIT includes oReBar:Hide( ).
// 3) When a dialog is closed, oReBar:Show( ) is issued.
// 4) In past versions, the bar was displayed and the label font never changed
// 5) With 12.04, when the Show( ) is issued, the bar returns, but with a larger font.
// 6) This is consistent with ALL dialog calls.

oBar:SetColor( 0)

oBar:bClrGrad = { | lInvert | If( ! lInvert, ;
   { { 0.90,14853684,16314573 }, ;
     { 0.90,16314573,14853684 } }, ;
   { { 0.90,14853684,14853684 }, ;
     { 0.90,14853684,14853684 } } ) }

DEFINE BUTTON oButt1 OF oBar FILE c_path + "\project\EXPLORER.BMP" ;
MESSAGE "Button 1" ;
ACTION D_START() ;
PROMPT "Button 1"

oButt1:cToolTip := { " " + CRLF + "Button 1", "1. Button", 1, 0, 128 }
oButt1:SetColor( 128 )
oButt1:SetFont(  oButtFont1 )

DEFINE BUTTON oButt2 OF oBar FILE c_path + "\project\TRASH.BMP" ;
MESSAGE "Button 2" ;
ACTION MsgAlert( "Button 1","Attention" ) ;
PROMPT "Button 2"

oButt2:cToolTip := { " " + CRLF + "Button 2", "2. Button", 1, 0, 128 }
oButt2:SetFont(  oButtFont2 )

DEFINE BUTTON oButt3 OF oBar FILE c_path + "\project\VISA.BMP" ;
MESSAGE "Button 3" ;
ACTION MsgAlert( "Button 3","Attention" ) ;
PROMPT "Button 3"

oButt3:cToolTip := { " " + CRLF + "Button 3", "3. Button", 1, 0, 128 }
oButt3:SetFont(  oButtFont3 )

DEFINE BUTTON oButt4 OF oBar FILE c_path + "\project\ICHAT.BMP" ;
MESSAGE "Button 4" ;
ACTION MsgAlert( "Button 4","Attention" ) ;
PROMPT "Button 4"

oButt4:cToolTip := { " " + CRLF + "Button 4", "4. Button", 1, 0, 128 }

DEFINE BUTTON oButt5 OF oBar FILE c_path + "\project\PENDRIVE.BMP" ;
MESSAGE "Button 5" ;
ACTION MsgAlert( "Button 5","Attention" ) ;
PROMPT "Button 5"

oButt5:cToolTip := { " " + CRLF + "Button 5", "5. Button", 1, 0, 128 }

DEFINE BUTTON oButt6 OF oBar FILE c_path + "\project\Stop.bmp"  MESSAGE "Close" ;
ACTION ( oWnd:End() ) ;
PROMPT "Close"

oButt6:cToolTip := { " " + CRLF + "Close Bartest", "Close", 1, 0, 128 }

AEval( oWnd:aControls, { | o | o:oCursor := oCursorHand } )

SET MESSAGE OF oWnd TO "Bar-Test" ;
CENTERED CLOCK KEYBOARD 2007

ACTIVATE WINDOW oWnd MAXIMIZED ;

oBrush:End()
oButtFont1:End()
oButtFont2:End()
oButtFont3:End()

RETURN NIL

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

FUNCTION D_START()
LOCAL oDlg1

LOCAL oDlgFont := TFont():New("Arial",,-12,.F.,.F.,,,,.F.)

DEFINE DIALOG oDlg1 SIZE 200, 300  TITLE "Dialog-test" FONT oDlgFont OF oWnd ;
PIXEL TRANSPARENT


ACTIVATE DIALOG oDlg1 CENTERED  ;
ON INIT ( oBar:Hide(),  oDlg1:Move( 200, 300, 500, 400, .f. ) )

oDlgFont:End()
oBar:Show()

RETURN NIL
 


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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Button labels changing font size

Postby Rick Lipkin » Mon May 21, 2012 8:21 pm

Uwe

Along those same lines .. I am seeing my Buttonbar with version 1203 just become un-responsive when I click on a button from a MDI buttonbar to a mdichild .. close the mdichild and from time to time the oBar seems like it is disabled and I have not disabled it in the mdichild.

The only thing different in this button bar is the MDI bar has groups associated with it and when you run OwnView() associated with oPopUtl menu .. when the program returns control from OwnView() which is a mdichild .. oBar becomes un-responsive... you can click the X close and any menu option from the BuildMenu function works.. just oBar is dead.

I have not yet worked up a small example .. just curious if anyone else has experienced this behavoir?

Thanks
Rick Lipkin

Code: Select all  Expand view

//----- main menu -------//

xMESSAGE :=  "User  "+xLOGIN+"    Rights  "+cRIGHTS+        ;
      "     Default= "+cDEFA+"      Rdd= "+cRDD+            ;
      "     Revision  "+DTOC(dEXE)+;
      "  -r"+str(nSCR1,4)+" x "+STR(nSCR2,4)

DEFINE ICON oICO RESOURCE "PMO"

DEFINE WINDOW oWindMain                                      ;
   FROM 0,2 to 28,78                                         ;
   TITLE "PMO Strategic Projects Vital Signs"                ;
   MENU BuildMenu(cOLDDEFA,dEXE,cRDD,nSCR1,nSCR2,lFROMLINK,xPROJECTEID,oWindMain);
   ICON oICO                                                 ;
   MDI

  DEFINE BITMAP oBMAP FILENAME (cOLDDEFA+"\PMO.BMP") of oWindMain
                                      // 56, 64
  DEFINE BUTTONBAR oBar OF oWindMain SIZE 56,58 2010
  *     oBar:SetColor( 0)

  oBar:bClrGrad = { || { { 0.10,15724527,7303023 }, ;
                       { 0.10,7303023,15724527 } } }

  DEFINE BUTTON oButt1 of oBar ACTION ( _ProjBrow(oWindMain, lFROMLINK, xPROJECTEID, oBar ))  ;
              RESOURCE "compas",;
                       "DCompas",;
                       "DCompas";
              PROMPT "Projects" ;
              TOOLTIP "Project Management Information"

  //--------  group --
  MENU oPopRpt1 POPUP
     MENUITEM "PMO Project Status Report" FileName (cDefa+"\Icons\FOLDEROPEN.bmp") ;
              ACTION ( _ProjList() )
     MENUITEM "PMO Delinquent Reminder Reporting" FileName (cDefa+"\Icons\FOLDERCLOSED.bmp");
              ACTION ( _ProjDelq() )
     MENUITEM "PMO Delinquent Reporting Generation" FileName (cDefa+"\Icons\FOLDERDETAIL.bmp");
              ACTION ( Msginfo( "Under Construction" ))
     MENUITEM "PMO Delinquent Reporting Generation" FileName (cDefa+"\Icons\FOLDERCLOSED.bmp");
              ACTION (_Delinq() )
  ENDMENU


  DEFINE BUTTON oButt2 of oBar   ;
              RESOURCE "reports",;
                       "DReports",;
                       "DReports";
              PROMPT "Reports" ;
              ACTION oButt2:ShowPopup()GROUP;
              MENU oPopRpt1 ;
              TOOLTIP "Reports"


  //--------  group --
  MENU oPopUtl POPUP
     MENUITEM "System Parameters" FileName (cDefa+"\Icons\FOLDEROPEN.bmp") ;
              ACTION ( _OwnView( "E", oWindMain ) )
     MENUITEM "User and  Project Mgr Information" FileName (cDefa+"\Icons\FOLDERCLOSED.bmp");
              ACTION ( _userbrow( oWindMain ) )
     MENUITEM "Sponsor and Customer Information" FileName (cDefa+"\Icons\FOLDERDETAIL.bmp");
              ACTION ( _Spbrow( oWindMain ) )
     MENUITEM "Frequency Indicator Information" FileName (cDefa+"\Icons\FOLDERCLOSED.bmp");
              ACTION ( _FreqBrow( oWindMain ) )
     MENUITEM "Role Information" FileName (cDefa+"\Icons\FOLDERDETAIL.bmp");
              ACTION ( _Rolebrow( oWindMain ) )
     MENUITEM "Master Strategic Goals" FileName (cDefa+"\Icons\FOLDERDETAIL.bmp");
              ACTION ( _Mg_brow( oWindMain ) )
  ENDMENU

  DEFINE BUTTON oButt3 of oBar   ;
              RESOURCE "utility",;
                       "DUtility",;
                       "DUtility";
              PROMPT "Utilities" ;
              ACTION oButt3:ShowPopup()GROUP;
              MENU oPopUtl ;
              TOOLTIP "Utilities and Setup Parameters"

  DEFINE BUTTON oButt4 of oBar ACTION ( oWindMain:End())  ;
              RESOURCE "quit";
              PROMPT "Quit" ;
              TOOLTIP "Quit and Close this Program"


  SET MESSAGE OF oWindMain    ;
      to xMESSAGE CLOCK 2010

ACTIVATE WINDOW oWindMain     ;
   MAXIMIZED ;
   ON PAINT ( IF( xTEXT = "/NL", ,PalBmpDraw( hDC, 0,0, oBMAP:hBitmap, oBMAP:hPalette, nSCR1, nSCR2 )));
   ON INIT ( IF( xTEXT = "/NL", , MSGLOGO( cDEFA+"\SPLASH.BMP",2 )), ;
             IF( nSCR1 < 1024, _ResMessage(nSCR1, nSCR2), ),;
             IF( lFIRST = .T., _OwnView( "A", oWindMain), ),;
             IF( lFROMLINK = .T., _ProjBrow( oWINDMain, lFROMLINK, xPROJECTEID ), ),;
             IF( lSENDMAIL = .T., SendMail(),  ), oWINDMain:Select(),  oWINDMain:Refresh() ) ;
   VALID ( IIF( !lExitPgm, ExitPgm( .T.,@lExitPgm ) , .F. ))

RETURN( NIL )


 
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Button labels changing font size

Postby TimStone » Mon May 21, 2012 8:48 pm

Here is a small section of how I implemented this ...

Code: Select all  Expand view


        // Now open the window and apply settings
        DEFINE WINDOW oWnd TITLE mlsTitle FROM 0,0 TO 800, 1150 PIXEL MENU BuildMenu( )

        oWnd:SetIcon( oWIcon )
        oWnd:oFont := oMfont
        oWnd:nHelpID := 19
        WNDCENTER( oWnd:hWnd ) // Center the window on the screen

        DEFINE BUTTONBAR oReBar OF oWnd SIZE 50,60  2007
        DEFINE BUTTON OF oReBar RESOURCE "ORDER" PROMPT "Order" ACTION PRO100M( ) ;
            TOOLTIP "Workorders" FONT oBfont
        DEFINE BUTTON OF oReBar RESOURCE "HRHIST" PROMPT "History" ACTION PRO7500( );
            TOOLTIP "Service History" FONT oBfont
        DEFINE BUTTON OF oReBar RESOURCE "INVENT" PROMPT "Parts" ACTION PRO2100( );
            TOOLTIP "Inventory Editor" FONT oBfont GROUP
        DEFINE BUTTON OF oReBar RESOURCE "LOSTSALE" PROMPT "Lost" ACTION PRO2810( );
            TOOLTIP "Lost Sales" FONT oBfont
        DEFINE BUTTON OF oReBar RESOURCE "CLIENT" PROMPT "Client" ACTION PRO3100( ) ;
            TOOLTIP "Client Editor" FONT oBfont GROUP
        DEFINE BUTTON OF oReBar RESOURCE sBmp[1] PROMPT sLbl[1] ACTION PRO3200( ) ;
            TOOLTIP sLbl[1] + " Editor" FONT oBfont

            ....  Additional coded buttons continue here

        // Activate the window
ACTIVATE WINDOW oWnd ON PAINT MainWinBckgrnd( hDC, oWnd )  VALID MsgYesNo( "Do you want to quit ? ", "Exiting ")
 


From this main window, I call Dialogs which hide this button bar, then show it upon exiting. This is to keep clients from trying to activate the main buttons.

These are the font definitions used in the above:
DEFINE FONT oMfont NAME cSysFont SIZE 0,-12 BOLD
DEFINE FONT oBfont NAME "Arial" SIZE 0,-10 BOLD
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Button labels changing font size

Postby Antonio Linares » Tue May 22, 2012 11:21 am

Tim,

Please replace this line:

oWnd:oFont := oMfont

with:

oWnd:SetFont( oMfont )

as Fonts use (internal) counters to reuse them. If you assign it as you were doing it, the counter is not increased, but it is decreased when an object using the font ends, and then it reaches a point where you are instructing FWH to end the font too. The larger font you see is the system default font when yours is no longer valid.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Button labels changing font size

Postby TimStone » Tue May 22, 2012 3:00 pm

Thank you. Its working fine now.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Button labels changing font size

Postby TimStone » Wed May 23, 2012 1:22 am

Well, I guess it is NOT working fine now.

Here is the problem. If I simply open a dialog, then the error does not occur. HOWEVER, if I then set the focus to an xBrowse, and scroll down it, then leave the dialog, the problem appears.

I checked the file carefully, and there is no re-definition of that font object.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Button labels changing font size

Postby TimStone » Mon Jun 25, 2012 6:11 pm

Bumping this up ... it is still unresolved ( see last comment please ).

Thanks !
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Button labels changing font size

Postby Antonio Linares » Mon Jun 25, 2012 6:32 pm

Tim,

How do you create oMfont ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Button labels changing font size

Postby TimStone » Mon Jun 25, 2012 6:42 pm

oMFont is declared as a Public in the MAIN() module

It is set only once, and never changed, using:

cSysFont := GetSysFont( )
DEFINE FONT oMfont NAME cSysFont SIZE 0,-12 BOLD

All dialogs then have FONT oMFont in their statement.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Button labels changing font size

Postby Antonio Linares » Mon Jun 25, 2012 6:51 pm

Tim,

Are you calling oMFont:End() somewhere in your code ?

Class TFont objects use a counter, so they can be shared among several objects (dialogs, controls, etc). When the counter (cCount) reaches zero then the font is really released. If your font gets released (thats why it changes) then it means that there are extra calls to :End().

You can check MsgInfo( oMFont:nCount ) from some places in your code, to see if it keeps constant or decreases. As a workaround you can manualy increase it:

oMFont:nCount += 5 // or any other value
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Button labels changing font size

Postby TimStone » Mon Jun 25, 2012 7:02 pm

I will track that. Nope .. I don't issue oMfont:end() anywhere ...

Thanks for the info.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 91 guests