FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Two bugs in buttonbar [Solved]
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Two bugs in buttonbar [Solved]
Posted: Mon Apr 04, 2011 10:16 PM
1. Move the mouse pointer over the button: the bitmap slightly shifts down.

2. Comment out the 2007 clause and you will get an error.

The sample:

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


FUNCTION MAIN()

    LOCAL oDlg

    DEFINE DIALOG oDlg

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

    RETURN NIL


STATIC FUNCTION TOOLBAR( oDlg )

    LOCAL oBtn

    DEFINE BUTTONBAR SIZE 40, 45 OF oDlg 2007

    DEFINE BUTTON oBtn;
           OF oDlg:oBar;
           FILE "C:\FWH\BITMAPS\CLOSE.BMP";
           PROMPT "Test";
           ACTION oDlg:End()

    RETURN NIL


EMG
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Two bugs in buttonbar
Posted: Fri Apr 08, 2011 10:11 AM
A possible solution to the first bug is to move up the following code:

Code (fw): Select all Collapse
   if ::l2007
      if ! Empty( ::cCaption )
         if ::oFont == nil
            ::SetFont( ::oWnd:oFont )
            if ::oFont == nil .and. ! Empty( ::oWnd )
               ::SetFont( ::oWnd:oWnd:oFont )
            endif
         endif
      endif
   endif


as ::nGetChrHeight() needs that the font is already assigned.

EMG
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Two bugs in buttonbar
Posted: Fri Apr 08, 2011 11:40 AM
A possible fix for the second bug:

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


EMG
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: Two bugs in buttonbar
Posted: Fri Apr 08, 2011 03:30 PM

Enrico,

podrias ayudarme a ubicar donde realizar los cambios indicados, :-)

Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Two bugs in buttonbar
Posted: Fri Apr 08, 2011 05:38 PM
Yes. Locate this:

Code (fw): Select all Collapse
   if ::l2007
      if ! Empty( ::cCaption )
         if ::oFont == nil
            ::SetFont( ::oWnd:oFont )
            if ::oFont == nil .and. ! Empty( ::oWnd )
               ::SetFont( ::oWnd:oWnd:oFont )
            endif
         endif
      endif
      if ::lPressed
         nBmpTop++
         nBmpLeft++
         nAdjust := 1
      endif


and replace with:

Code (fw): Select all Collapse
   if ::l2007
      if ::lPressed
         nBmpTop++
         nBmpLeft++
         nAdjust := 1
      endif


Then locate this:

Code (fw): Select all Collapse
   if ::lBarBtn
      ::lRound = .F.
   endif


and replace with:

Code (fw): Select all Collapse
   if ::lBarBtn
      ::lRound = .F.
   endif

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


Finally, locate this:

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


and replace with:

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


But I'd wait for Antonio's ok.

EMG
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: Two bugs in buttonbar
Posted: Sat Apr 09, 2011 08:49 PM

thanks you.

Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Two bugs in buttonbar
Posted: Sat Apr 09, 2011 11:36 PM

Dear Enrico,

If it is working fine then please upload it to the repository, thanks :-)

regards, saludos

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

Continue the discussion