Bug in TBtnBmp [Solved]
- Enrico Maria Giordano
- Posts: 8736
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 1 time
- 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: 42414
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 12 times
- Been thanked: 48 times
- 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: 8736
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 1 time
- Contact:
- Antonio Linares
- Site Admin
- Posts: 42414
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 12 times
- Been thanked: 48 times
- 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 | Expand
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
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
- Enrico Maria Giordano
- Posts: 8736
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 1 time
- 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: 42414
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 12 times
- Been thanked: 48 times
- 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: 8736
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 1 time
- Contact:
Re: Bug in TBtnBmp
Antonio,
Yes. it doesn't make any difference.
Thank you, my friend!
EMG
Antonio Linares wrote:Enrico,
Just curiosity, have you tried with + 2 ?
Yes. it doesn't make any difference.
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
Thank you, my friend!
EMG
- Antonio Linares
- Site Admin
- Posts: 42414
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 12 times
- Been thanked: 48 times
- 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 | Expand
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: 8736
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 1 time
- Contact:
Re: Bug in TBtnBmp
Antonio,
Sorry, no change. The problem seems to be here:
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
Antonio Linares wrote:Enrico,
Please change it this way and it should work fine:Code: Select all | Expand
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
Sorry, no change. The problem seems to be here:
Code: Select all | Expand
DrawTransBmp( ::hDC, hBmp, oBmpRect:nTop, oBmpRect:nLeft, oBmpRect:nWidth, oBmpRect:nWidth )
If I change it to this:
Code: Select all | Expand
DrawTransBmp( ::hDc, hBmp, oBmpRect:nTop + 1, oBmpRect:nLeft + 1, oBmpRect:nWidth, oBmpRect:nWidth )
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
- Antonio Linares
- Site Admin
- Posts: 42414
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 12 times
- Been thanked: 48 times
- 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: 8736
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 1 time
- Contact:
Re: Bug in TBtnBmp
Antonio,
here they are:
EMG
here they are:
Code: Select all | Expand
REDEFINE BTNBMP;
ID 109 OF oDlg;
RESOURCE "BMP1", NIL, "BMP2";
ACTION ...
Code: Select all | Expand
CONTROL "", 109, "TBtnBmp", WS_CHILD | WS_VISIBLE, 207, 125, 10, 13
EMG
- Antonio Linares
- Site Admin
- Posts: 42414
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 12 times
- Been thanked: 48 times
- Contact:
- Enrico Maria Giordano
- Posts: 8736
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 1 time
- Contact:
Re: Bug in TBtnBmp
Antonio,
yes, here it is:
EMG
yes, here it is:
Code: Select all | Expand
#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
EMG
- Antonio Linares
- Site Admin
- Posts: 42414
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 12 times
- Been thanked: 48 times
- 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: 8736
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 1 time
- 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