TBtnBmp problem

TBtnBmp problem

Postby StefanHaupt » Tue Jun 26, 2007 9:36 am

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 view
#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
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Postby Antonio Linares » Tue Jun 26, 2007 9:57 am

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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby StefanHaupt » Tue Jun 26, 2007 11:07 am

Antonio,

ok, thanks for the info.

Is there a way, to change this behavior ?

kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Postby Antonio Linares » Tue Jun 26, 2007 1:25 pm

Stefan,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby StefanHaupt » Wed Jun 27, 2007 7:36 am

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
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Postby Antonio Linares » Wed Jun 27, 2007 12:06 pm

Stefan,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby StefanHaupt » Wed Jun 27, 2007 3:25 pm

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
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Postby Antonio Linares » Wed Jun 27, 2007 4:06 pm

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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby StefanHaupt » Wed Jun 27, 2007 8:38 pm

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

Postby StefanHaupt » Wed Jun 27, 2007 9:50 pm

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
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 79 guests