Font in button bar changes with recent FWH

Font in button bar changes with recent FWH

Postby hua » Wed Nov 16, 2011 2:57 am

After recompilation with FWH11.8 instead of 10.5, my button bar became from this:
Image

to this:
Image

How do I fix this? TIA.
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Font in button bar changes with recent FWH

Postby Antonio Linares » Wed Nov 16, 2011 5:03 am

Hua,

Please post the source code that you are using to create your button bar, thanks
regards, saludos

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

Re: Font in button bar changes with recent FWH

Postby hua » Wed Nov 16, 2011 6:23 am

Hi Antonio. Thank you for the reply. Here's the code:
Code: Select all  Expand view
method buildBar() class TWinCMS
   local oPopup, oBtn, oPopup1, obtn1, oFont

   ::oBarBtns := array(BTNBAR_MAX)

   DEFINE BUTTONBAR ::oBar OF ::oWnd SIZE 60, 60 2007

   // Files
   MENU oPopup1 POPUP
      MENUITEM "TradePac Accounting Series"  ACTION  ::xtract(1)
      *MENUITEM "3rd Party Accounting Software"    ACTION  ::xtract(2)
      SEPARATOR
      MENUITEM "Configure..." action ::oXtract:activate()
   ENDMENU

   DEFINE BUTTON ::oBarBtns[BTNBAR_XTRACT] oBtn1 OF ::oBar ACTION ::xtract(1) ;
      RESOURCE "extract" PROMPT "Extract"  ;
      MENU oPopup1 TOOLTIP "Extract A/R"

   DEFINE BUTTON ::oBarBtns[BTNBAR_NEW] OF ::oBar ACTION ::add() ;
      RESOURCE "new" PROMPT "New" TOOLTIP "New Customer"
  .
  .


I suspect this is because of the change in TBtnBmp:Paint() because it's defaulting the font from oWnd now. Previously the following code doesn't exist
Code: Select all  Expand view

   if ! Empty( ::cCaption )
      if ::oFont == nil
         ::SetFont( ::oWnd:oFont )
         if ::oFont == nil .and. ! Empty( ::oWnd )
            ::SetFont( ::oWnd:oWnd:oFont )
         endif
      endif
   endif


It seems to be used to replace this:
Code: Select all  Expand view

   if ::lBarBtn
      ::l2007 = ::oWnd:l2007
      if ::oFont == NIL
         if ::oWnd:oFont != nil
            if ::oWnd:oFont:cFaceName != "Tahoma"
               DEFINE FONT oFont NAME "Tahoma" SIZE 0, -11
               ::oWnd:SetFont( oFont )
            endif
            ::SetFont( ::oWnd:oFont )
         else
            DEFINE FONT oFont NAME "Tahoma" SIZE 0, -11
            ::SetFont( oFont )
         endif
      else
         ::oWnd:SetFont( ::oFont )
      endif
   else
      if ::oFont == nil
         ::SetFont( ::oWnd:oFont )
         if ::oFont == nil .and. ! Empty( ::oWnd )
           ::SetFont( ::oWnd:oWnd:oFont )
         endif
      else
         ::SetFont( ::oFont )
      endif
   endif
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Font in button bar changes with recent FWH

Postby hua » Wed Nov 16, 2011 6:34 am

I think for now I'll use the following method to resolve the issue from my code
Code: Select all  Expand view

method buildBar() class TWinCMS
   DEFINE FONT oFont NAME "Tahoma" SIZE 0,-11
    .
    .
   aeval(::oBar:aControls, {|o| o:setFont(oFont)})
   oFont:end()
  return nil
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Font in button bar changes with recent FWH

Postby Antonio Linares » Wed Nov 16, 2011 10:27 am

Hua,

Yes, thats a good solution. Thanks! :-)
regards, saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 107 guests