Bug in TBtnBmp [Solved]
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Bug in TBtnBmp
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
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
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Bug in TBtnBmp
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
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
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Bug in TBtnBmp
Antonio,
EMG
Unfortunately it is not properly fixed. I had to revert to the previous btnbmp.prg again.* Fix: There was a painting error in Class TBtnBmp due to recent changes in
Class TBtnBmp. Now it is ok.
EMG
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Bug in TBtnBmp
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
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
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Bug in TBtnBmp
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
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
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Bug in TBtnBmp
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
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
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Bug in TBtnBmp
Enrico,
The black border is painted from here (Class TBtnBmp Method Paint()):
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
The black border is painted from here (Class TBtnBmp Method Paint()):
Code: Select all
if ::lBorder
WndBox( ::hDC, 0, 0, ::nHeight - 1, ::nWidth - 1 )
endif
Please try it and lets see if the paiting improves, thanks
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Bug in TBtnBmp
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
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
Antonio, a mi me ocurre lo mismoEnrico 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, I so do I
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Bug in TBtnBmp
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:
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
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
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
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
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Bug in TBtnBmp
Antonio,
can you send me the modified btnbmp.prg, please?
EMG
can you send me the modified btnbmp.prg, please?
EMG
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Bug in TBtnBmp
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.
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.
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Bug in TBtnBmp
Ok, can you send me the original btnbmp.prg? I replaced it with the working one.
EMG
EMG
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Bug in TBtnBmp
Antonio,
I already have the new btnbmp.prg!
EMG
I already have the new btnbmp.prg!
EMG
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Bug in TBtnBmp
Antonio,
EMG
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.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.
EMG