TBtnBmp problem

Post Reply
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

TBtnBmp problem

Post by StefanHaupt »

Dear friends,

there is a little problem using tbtnbmp with a brush. If i set ::ltransparent = .t., the focus-rect is not shown moving the mouse over the button. If ::lTransparent is .f., it´s working fine.

The following sample shows this issue.

Code: Select all | Expand

#Include "FiveWin.ch"

//----------------------------------------------------------------------------//
static oWnd, oBar,oB1, oBrush, oB2

Func Main()

   Define Window oWnd From 0, 0 To 15, 65 ;
       Title "Bar-Test "

   define BRUSH oBrush FILE "Xp.bmp"

   define BUTTONBAR oBar OF oWnd 3DLOOK SIZE 26,26
   oBar:oBrush:= oBrush

   define BUTTON oB1 OF oBar FILE "Calc.bmp" ACTION MsgInfo ("B1") NOBORDER
   define BUTTON oB2 OF oBar FILE "Calendar.bmp" ACTION MsgInfo ("B2") NOBORDER
   oB1:lTransparent := .t.
   oB1:oBrush := oBrush
   //oB2:lTransparent := .t.
   oB2:oBrush := oBrush
   oB1:Refresh()

   Activate Window oWnd

Retu nil


Can anyone confirm this behavior ?

Is there a solution for this ?


kind regards
Stefan
User avatar
Antonio Linares
Site Admin
Posts: 42521
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 76 times
Contact:

Post by Antonio Linares »

Stefan,

If transparent is used, then thats the expected behavior, just to see the image and be able to push it
regards, saludos

Antonio Linares
www.fivetechsoft.com
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Post by StefanHaupt »

Antonio,

ok, thanks for the info.

Is there a way, to change this behavior ?

kind regards
Stefan
User avatar
Antonio Linares
Site Admin
Posts: 42521
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 76 times
Contact:

Post by Antonio Linares »

Stefan,

Yes, you can easily modify the Class source code
regards, saludos

Antonio Linares
www.fivetechsoft.com
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Post by StefanHaupt »

Antonio,

in the class btnbmp are many occurences of DrawFocusRect(), but no call depends on ::ltransparent.

In my opinion the method MouseMove is responsible for showing the focus-rect.

I don´t understand what i have to change. Could you please help me ?

Many thanks

kind regards
Stefan
User avatar
Antonio Linares
Site Admin
Posts: 42521
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 76 times
Contact:

Post by Antonio Linares »

Stefan,

Do you mean this border around the button ?
Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Post by StefanHaupt »

Antonio,

yes, i mean the border that comes up if i move the mouse over the button. It does not appear, if ltransparent is true.

kind regards
Stefan
User avatar
Antonio Linares
Site Admin
Posts: 42521
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 76 times
Contact:

Post by Antonio Linares »

In my screenshot lTransparent is used.

Don't use a bitmap whose image is too close to the left edge
regards, saludos

Antonio Linares
www.fivetechsoft.com
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Post by StefanHaupt »

Antonio Linares wrote:In my screenshot lTransparent is used.

Don't use a bitmap whose image is too close to the left edge


What do you mean ? I use the standard bitmaps 16x16.

I made 2 screenshots, to show what happens.

Button2 is not transparent, the rect is shown, Button 3 is transparent, the rect is not shown moving the mouse over the buttons.

Image

Image

It seems the rect is painted transparent.
kind regards
Stefan
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Post by StefanHaupt »

Antonio,

i made some tests and i found that the transparent bitmap (the right one) is nearer to the left edge, it´s not centered as the left bitmap (not transparent). These buttons are painted with a border to show the difference.

Image

TransBmp() seems to move the bitmap to the left.
kind regards
Stefan
Post Reply