Bug in TBtnBmp [Solved]
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Bug in TBtnBmp [Solved]
There's something different in the size of the bitmaps painted over bitmap buttons. Please check.
EMG
EMG
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Bug in TBtnBmp
Enrico,
Here it seems ok. Could you please provide an example or a screenshot ? thanks
Here it seems ok. Could you please provide an example or a screenshot ? thanks
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Bug in TBtnBmp
Antonio,
screenshots sent. Let me know if you received them.
EMG
screenshots sent. Let me know if you received them.
EMG
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Bug in TBtnBmp
Enrico,
Yes, I got them. Thanks
In FWH 14.04 there is a change in Class TBtnBmp Method Paint, in line 1360:
In this line please try to add a +1 in nTop and nLeft:
PalBmpDraw( ::hDC, oBmpRect:nTop + 1, oBmpRect:nLeft + 1, hBmp, hPal, oBmpRect:nWidth, oBmpRect:nHeight, ;
nil, ::lBmpTransparent )
thanks
Yes, I got them. Thanks
In FWH 14.04 there is a change in Class TBtnBmp Method Paint, in line 1360:
Code: Select all
if ! Empty( hBmp )
if ::lBmpTransparent
if SetAlpha() .and. ::aAlpha[ nBtn ]
ABPaint( ::hDC, oBmpRect:nLeft, oBmpRect:nTop, hBmp, ::nAlphaLevel() )
else
DrawTransBmp( ::hDc, hBmp, oBmpRect:nTop, oBmpRect:nLeft, oBmpRect:nWidth, oBmpRect:nWidth )
endif
else
PalBmpDraw( ::hDC, oBmpRect:nTop, oBmpRect:nLeft, hBmp, hPal, oBmpRect:nWidth, oBmpRect:nHeight, ;
nil, ::lBmpTransparent )
endif
endif
PalBmpDraw( ::hDC, oBmpRect:nTop + 1, oBmpRect:nLeft + 1, hBmp, hPal, oBmpRect:nWidth, oBmpRect:nHeight, ;
nil, ::lBmpTransparent )
thanks
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Bug in TBtnBmp
Antonio,
no, unfortunately it is not enough. The image is still not centered and the button still miss the border.
EMG
no, unfortunately it is not enough. The image is still not centered and the button still miss the border.
EMG
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Bug in TBtnBmp
Enrico,
Just curiosity, have you tried with + 2 ?
It seems to me as those functions are using the coordinates in a different way. We are going to review it, thanks
Just curiosity, have you tried with + 2 ?
It seems to me as those functions are using the coordinates in a different way. We are going to review it, thanks
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Bug in TBtnBmp
Antonio,
EMG
Yes. it doesn't make any difference.Antonio Linares wrote:Enrico,
Just curiosity, have you tried with + 2 ?
Thank you, my friend!Antonio Linares wrote:It seems to me as those functions are using the coordinates in a different way. We are going to review it, thanks
EMG
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Bug in TBtnBmp
Enrico,
Please change it this way and it should work fine:
Please change it this way and it should work fine:
Code: Select all
if ! Empty( hBmp )
if ::lBmpTransparent
if SetAlpha() .and. ::aAlpha[ nBtn ]
ABPaint( ::hDC, oBmpRect:nLeft, oBmpRect:nTop, hBmp, ::nAlphaLevel() )
else
DrawTransBmp( ::hDC, hBmp, oBmpRect:nTop, oBmpRect:nLeft, oBmpRect:nWidth, oBmpRect:nWidth )
endif
else
DrawTransBmp( ::hDC, hBmp, oBmpRect:nTop, oBmpRect:nLeft, oBmpRect:nWidth, oBmpRect:nWidth )
endif
endif
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Bug in TBtnBmp
Antonio,
If I change it to this:
the result is better but still different from the previous version. At least, there is no border anymore. How can I get the border back?
EMG
Sorry, no change. The problem seems to be here:Antonio Linares wrote:Enrico,
Please change it this way and it should work fine:
Code: Select all
if ! Empty( hBmp ) if ::lBmpTransparent if SetAlpha() .and. ::aAlpha[ nBtn ] ABPaint( ::hDC, oBmpRect:nLeft, oBmpRect:nTop, hBmp, ::nAlphaLevel() ) else DrawTransBmp( ::hDC, hBmp, oBmpRect:nTop, oBmpRect:nLeft, oBmpRect:nWidth, oBmpRect:nWidth ) endif else DrawTransBmp( ::hDC, hBmp, oBmpRect:nTop, oBmpRect:nLeft, oBmpRect:nWidth, oBmpRect:nWidth ) endif endif
Code: Select all
DrawTransBmp( ::hDC, hBmp, oBmpRect:nTop, oBmpRect:nLeft, oBmpRect:nWidth, oBmpRect:nWidth )
Code: Select all
DrawTransBmp( ::hDc, hBmp, oBmpRect:nTop + 1, oBmpRect:nLeft + 1, oBmpRect:nWidth, oBmpRect:nWidth )
EMG
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Bug in TBtnBmp
Enrico,
How do you create the TBtnBm control ? is it from resources ?
Please post here the RC section and the REDEFINE ... code, thanks
How do you create the TBtnBm control ? is it from resources ?
Please post here the RC section and the REDEFINE ... code, thanks
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Bug in TBtnBmp
Antonio,
here they are:
EMG
here they are:
Code: Select all
REDEFINE BTNBMP;
ID 109 OF oDlg;
RESOURCE "BMP1", NIL, "BMP2";
ACTION ...
Code: Select all
CONTROL "", 109, "TBtnBmp", WS_CHILD | WS_VISIBLE, 207, 125, 10, 13
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Bug in TBtnBmp
Enrico,
Could you provide an example without RCs ? thanks
Could you provide an example without RCs ? thanks
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Bug in TBtnBmp
Antonio,
yes, here it is:
EMG
yes, here it is:
Code: Select all
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg
DEFINE DIALOG oDlg;
SIZE 800, 600
@ 10, 10 BTNBMP SIZE 20, 20;
FILE "c:\fwh\bitmaps\open.bmp";
ADJUST
ACTIVATE DIALOG oDlg;
CENTER
RETURN NIL
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Bug in TBtnBmp
Enrico,
The bug was in front of our eyes and we were not seing it
DrawTransBmp( ::hDC, hBmp, oBmpRect:nTop, oBmpRect:nLeft, oBmpRect:nWidth, oBmpRect:nWidth )
obviously it has to be this way:
DrawTransBmp( ::hDC, hBmp, oBmpRect:nTop, oBmpRect:nLeft, oBmpRect:nWidth, oBmpRect:nHeight )
The bug was in front of our eyes and we were not seing it
DrawTransBmp( ::hDC, hBmp, oBmpRect:nTop, oBmpRect:nLeft, oBmpRect:nWidth, oBmpRect:nWidth )
obviously it has to be this way:
DrawTransBmp( ::hDC, hBmp, oBmpRect:nTop, oBmpRect:nLeft, oBmpRect:nWidth, oBmpRect:nHeight )
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Bug in TBtnBmp
Antonio,
yes, now the bitmaps are centered again, great! Please note that there are more than one place to fix.
Now, how to get the border back?
EMG
yes, now the bitmaps are centered again, great! Please note that there are more than one place to fix.
Now, how to get the border back?
EMG