Bug in TBtnBmp [Solved]

Re: Bug in TBtnBmp

Postby Enrico Maria Giordano » Fri May 30, 2014 3:14 pm

Antonio,

I have a proposal: why not to revert back to the previous btnbmp.prg that used to work very well? What was the reason behind the new changes?

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

Re: Bug in TBtnBmp

Postby Antonio Linares » Fri May 30, 2014 5:56 pm

Enrico,

The btnbmp source code is an old class (it comes with FWH since the very early beginning) and have been experiencing many transformations, so from time to time, we try to simplify and reorganice the code.

Recently Rao worked on it to simplify it, but it seems that still it is not ok. So yes, in the meantime, you could use the previous version and everything should work fine :-)
regards, saludos

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

Re: Bug in TBtnBmp

Postby Enrico Maria Giordano » Sat Jun 21, 2014 2:46 pm

Antonio,

* Fix: There was a painting error in Class TBtnBmp due to recent changes in
Class TBtnBmp. Now it is ok.


Unfortunately it is not properly fixed. I had to revert to the previous btnbmp.prg again. :-(

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

Re: Bug in TBtnBmp

Postby Antonio Linares » Sun Jun 22, 2014 12:26 am

Enrico,

I tested them on a ButtonBar and also on GET ... ACTION ... and seemed ok.

If I remember properly you provided here an example, I am going to review it.

thanks
regards, saludos

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

Re: Bug in TBtnBmp

Postby Antonio Linares » Sun Jun 22, 2014 12:29 am

Enrico,

I did my tests on FWH\samples\testbtnb.prg. I have just tested it again and seems fine.

Could you please run that example and see if it is fine there for you ? thanks
regards, saludos

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

Re: Bug in TBtnBmp

Postby Enrico Maria Giordano » Sun Jun 22, 2014 10:38 am

Antonio,

I just sent you an image showing the problem:

1. There is a black border that wasn't there before

2. The bitmap is not centered in the button anymore

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

Re: Bug in TBtnBmp

Postby Antonio Linares » Mon Jun 23, 2014 5:13 am

Enrico,

The black border is painted from here (Class TBtnBmp Method Paint()):

Code: Select all  Expand view  RUN
     if ::lBorder
         WndBox( ::hDC, 0, 0, ::nHeight - 1, ::nWidth - 1 )
      endif


If you do oBtn:lBorder := .F. then you will avoid it (at least for a temporary solution)

Please try it and lets see if the paiting improves, thanks :-)
regards, saludos

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

Re: Bug in TBtnBmp

Postby Enrico Maria Giordano » Mon Jun 23, 2014 7:51 am

Antonio,

no, sorry. The border went away, but:

1. it goes back when the mouse is over the button
2. the bitmap is still not centered
3. there is no 3D effect on the button anymore

:-(

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

Re: Bug in TBtnBmp

Postby cnavarro » Sun Jun 29, 2014 8:57 am

Enrico Maria Giordano wrote:Antonio,

no, sorry. The border went away, but:

1. it goes back when the mouse is over the button
2. the bitmap is still not centered
3. there is no 3D effect on the button anymore

:-(

EMG


Antonio, a mi me ocurre lo mismo
Antonio, I so do I
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Bug in TBtnBmp

Postby Antonio Linares » Sun Jun 29, 2014 1:06 pm

Enrico, Cristobal,

The source code for Class TBtnBmp Method Paint() has been evolving along the years and actually is quite messy.

So this morning I decided to reorganize it, to properly structure it and I have found this:

If you replace Method Paint() with this code:

Code: Select all  Expand view  RUN
METHOD Paint() CLASS TBtnBmp

   // local aInfo := ::DispBegin()

   if ::lTransparent
      SetBrushOrgEx( ::hDC, nBmpWidth( ::oWnd:oBrush:hBitmap ) - ::nLeft,;
                     nBmpHeight( ::oWnd:oBrush:hBitmap ) - ::nTop )
      FillRect( ::hDC, GetClientRect( ::hWnd ), ::oWnd:oBrush:hBrush )
   else
      if Empty( ::bClrGrad )
         FillRect( ::hDC, GetClientRect( ::hWnd ), ::oBrush:hBrush )
      else
         if ::aGrad != nil
            GradientFill( ::hDC, 0, 0, ::nHeight, ::nWidth, ::aGrad() )
         endif
      endif  
   endif

   // ::DispEnd( aInfo )

return nil


This way the background is properly filled. Now if you uncomment the calls to DispBegin() and DispEnd() an unexpected border appears at the top and at the left.

So in order to properly fix its painting we first need to know where this is coming from. Please test it and lets try to find why that is happening. Thanks :-)
regards, saludos

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

Re: Bug in TBtnBmp

Postby Enrico Maria Giordano » Sun Jun 29, 2014 2:08 pm

Antonio,

can you send me the modified btnbmp.prg, please?

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

Re: Bug in TBtnBmp

Postby Antonio Linares » Sun Jun 29, 2014 2:31 pm

I don't keep a copy of my changes today, sorry.

But just replace the Method Paint() in Class TBtnBmp and you will see what I mean.

We need to solve this before moving on and reorganize Method Paint()

My plan is to replace it with a much more structured code.
regards, saludos

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

Re: Bug in TBtnBmp

Postby Enrico Maria Giordano » Sun Jun 29, 2014 2:42 pm

Ok, can you send me the original btnbmp.prg? I replaced it with the working one. :-)

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

Re: Bug in TBtnBmp

Postby Enrico Maria Giordano » Sun Jun 29, 2014 2:49 pm

Antonio,

I already have the new btnbmp.prg! :-)

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

Re: Bug in TBtnBmp

Postby Enrico Maria Giordano » Sun Jun 29, 2014 2:54 pm

Antonio,

Antonio Linares wrote:This way the background is properly filled. Now if you uncomment the calls to DispBegin() and DispEnd() an unexpected border appears at the top and at the left.


I just tried but I don't see any border, with or without the two calls. And, by the way, I don't see the bitmap too, of course.

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

PreviousNext

Return to Bugs report & fixes / Informe de errores y arreglos

Who is online

Users browsing this forum: No registered users and 4 guests