Page 3 of 6

Re: Bug in TBtnBmp

PostPosted: Fri May 30, 2014 3:14 pm
by Enrico Maria Giordano
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

Re: Bug in TBtnBmp

PostPosted: Fri May 30, 2014 5:56 pm
by Antonio Linares
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 :-)

Re: Bug in TBtnBmp

PostPosted: Sat Jun 21, 2014 2:46 pm
by Enrico Maria Giordano
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

Re: Bug in TBtnBmp

PostPosted: Sun Jun 22, 2014 12:26 am
by Antonio Linares
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

Re: Bug in TBtnBmp

PostPosted: Sun Jun 22, 2014 12:29 am
by Antonio Linares
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

Re: Bug in TBtnBmp

PostPosted: Sun Jun 22, 2014 10:38 am
by Enrico Maria Giordano
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

Re: Bug in TBtnBmp

PostPosted: Mon Jun 23, 2014 5:13 am
by Antonio Linares
Enrico,

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

Code: Select all  Expand view
     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 :-)

Re: Bug in TBtnBmp

PostPosted: Mon Jun 23, 2014 7:51 am
by Enrico Maria Giordano
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

Re: Bug in TBtnBmp

PostPosted: Sun Jun 29, 2014 8:57 am
by cnavarro
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

Re: Bug in TBtnBmp

PostPosted: Sun Jun 29, 2014 1:06 pm
by Antonio Linares
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
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 :-)

Re: Bug in TBtnBmp

PostPosted: Sun Jun 29, 2014 2:08 pm
by Enrico Maria Giordano
Antonio,

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

EMG

Re: Bug in TBtnBmp

PostPosted: Sun Jun 29, 2014 2:31 pm
by Antonio Linares
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.

Re: Bug in TBtnBmp

PostPosted: Sun Jun 29, 2014 2:42 pm
by Enrico Maria Giordano
Ok, can you send me the original btnbmp.prg? I replaced it with the working one. :-)

EMG

Re: Bug in TBtnBmp

PostPosted: Sun Jun 29, 2014 2:49 pm
by Enrico Maria Giordano
Antonio,

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

EMG

Re: Bug in TBtnBmp

PostPosted: Sun Jun 29, 2014 2:54 pm
by Enrico Maria Giordano
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