Two bugs in buttonbar [Solved]

Two bugs in buttonbar [Solved]

Postby Enrico Maria Giordano » 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: Select all  Expand view
#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
User avatar
Enrico Maria Giordano
 
Posts: 8712
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Two bugs in buttonbar

Postby Enrico Maria Giordano » Fri Apr 08, 2011 10:11 am

A possible solution to the first bug is to move up the following code:

Code: Select all  Expand view
  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
User avatar
Enrico Maria Giordano
 
Posts: 8712
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Two bugs in buttonbar

Postby Enrico Maria Giordano » Fri Apr 08, 2011 11:40 am

A possible fix for the second bug:

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


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

Re: Two bugs in buttonbar

Postby carlos vargas » Fri Apr 08, 2011 3:30 pm

Enrico,

podrias ayudarme a ubicar donde realizar los cambios indicados, :-)
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
carlos vargas
 
Posts: 1720
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Two bugs in buttonbar

Postby Enrico Maria Giordano » Fri Apr 08, 2011 5:38 pm

Yes. Locate this:

Code: Select all  Expand view
  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: Select all  Expand view
  if ::l2007
      if ::lPressed
         nBmpTop++
         nBmpLeft++
         nAdjust := 1
      endif


Then locate this:

Code: Select all  Expand view
  if ::lBarBtn
      ::lRound = .F.
   endif


and replace with:

Code: Select all  Expand view
  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: Select all  Expand view
hOldFont = SelectObject( ::hDC, If( ::lBarBtn, ::oWnd:oFont:hFont, ::oFont:hFont ) )


and replace with:

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


But I'd wait for Antonio's ok.

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

Re: Two bugs in buttonbar

Postby carlos vargas » Sat Apr 09, 2011 8:49 pm

thanks you.
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
carlos vargas
 
Posts: 1720
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Two bugs in buttonbar

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



Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Willi Quintana and 112 guests