FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour BtnBmp (SOLVED)
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
BtnBmp (SOLVED)
Posted: Sun Sep 04, 2011 06:13 AM
Hi you all,

Does anyone knows how to get rid of this anoying line surronding BtnBmp's???



It appears when the mouse is on top of the button...

I've tried :lBoxSelect := .F.

Which is the only thing I found in the class that I think can do anything about it, but it does not do it....

Any help will be appreciated....

Thanks!!!

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 80
Joined: Tue Mar 25, 2008 09:03 PM
Re: BtnBmp
Posted: Sun Sep 04, 2011 03:27 PM

test with
oBtnbmp:lTRANSPARENT = .T.

saluti
Stefano

FWH 14.11 + xHarbour + bcc582
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
Re: BtnBmp
Posted: Sun Sep 04, 2011 03:33 PM

Thanks Stefano, but I already tried and did not work, It seems that I get this effect because of the color of my bitmaps, when I use a picture it does no doit...

I think it does that to create the effect of movement in the button....

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: BtnBmp
Posted: Sun Sep 04, 2011 03:53 PM
I included this Button, but cannot discover such Effect.
Maybe the way the Background is defined ?



Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
Re: BtnBmp
Posted: Sun Sep 04, 2011 04:17 PM
This is the way I define the control:

Code (fw): Select all Collapse
@ ( Cuadro2[1][1] + ( Btn2Height * 1 ) + 2 ), ( Cuadro2[1][2] + ( Btn2Width * 2 ) +  4 ) BTNBMP oBtnA[ 3]  OF oDialog FILENAME "\MayaPOS\graficos\botones\brush\negro-rojo.bmp" SIZE ( Btn2Width - 7 ), ( Btn2Height - 5 ) CENTER PIXEL ADJUST NOBORDER

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 80
Joined: Tue Mar 25, 2008 09:03 PM
Re: BtnBmp
Posted: Sun Sep 04, 2011 04:28 PM
try this example
bmp 32 bit

Stefano

+ + + + + + +
// Dialog test

#include "FiveWin.ch"

static oDlg,obmp
//----------------------------------------------------------------------------//

function Main()

DEFINE DIALOG oDlg TITLE "Dialog 1" FROM 0, 0 TO 20, 40 TRANSPARENT

* say ....
* get ....

ACTIVATE DIALOG oDlg CENTERED ON INIT (GradBrush( oDlg,nRGB( 255, 255, 255 ),rgb(255,246,143 )),dlgbmp())

return nil

FUNCTION dlgbmp()

@30,30 BTNBMP obmp file "..\bitmaps\exit.bmp" NOBORDER ACTION oDlg:end() of oDlg pixel SIZE 26,26


obmp:lTRANSPARENT = .T.

RETURN (NIL)


STATIC FUNCTION GradBrush( oDlgkk,color1,color2)
local hDC, hBmp, hBmpOld,obrush

hDC = CreateCompatibleDC( oDlgkK:GetDC() )
hBmp = CreateCompatibleBitMap( oDlgkK:hDC, oDlgkK:nWidth, oDlgkK:nHeight )
hBmpOld = SelectObject( hDC, hBmp )

Gradient( hDC, {0, 0, oDlgkk:nHeight, oDlgKk:nWidth } ,color1,color2, .t. )

DeleteObject( oDlgkK:hBrush )
oDlgkK:hBitmap = hBmp
oDlgkK:hBrush = CreatePatternBrush( hBmp )
SelectObject( hDC, hBmpOld )
oDlgKk:ReleaseDC()

RETURN (nil)

//-------------------------------------------------------------------//
DLL32 FUNCTION CREATECOMPATIBLEBITMAP( hDC AS LONG,;
nWidth AS LONG,;
nHeight AS LONG) AS LONG;
PASCAL FROM "CreateCompatibleBitmap" LIB "gdi32.dll"
FWH 14.11 + xHarbour + bcc582
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
Re: BtnBmp
Posted: Sun Sep 04, 2011 05:23 PM
Thanks Mr. Stefano, but it did not worked for me when applied to my window...

In your sample, the new dialog copies the background for some reazon...

This is an example that reproduces the problem:

Code (fw): Select all Collapse
#include "FiveWin.ch"

static oDialog

FUNCTION main()

    DEFINE WINDOW oDialog ;
        FROM 0, 0 TO WndHeight( GetDesktopWindow() ), ; //- fhTaskBar() )
         WndWidth( ( GetDesktopWindow() ) ) ;
        PIXEL ;
        COLOR CLR_WHITE,CLR_BLACK;
        TITLE "Button";
        STYLE nOR( WS_POPUP );
        NOSYSMENU 
        
          @ 10,10 BTNBMP oBtnA  OF oDialog FILENAME "negro-rojo.bmp" SIZE  80, 80 CENTER PIXEL ADJUST NOBORDER
          
     ACTIVATE WINDOW  oDialog

Return NIL

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: BtnBmp
Posted: Sun Sep 04, 2011 06:36 PM
Yes, there are different Results.
Make a Test and define a brush-function on Init with the included Buttons.
On Button-click, there are no white borders.

Code (fw): Select all Collapse
FUNCTION main()

PUBLIC c_path := CURDRIVE() + ":\" + GETCURDIR() 

DEFINE WINDOW oWndMain ;
        FROM 0, 0 TO WndHeight( GetDesktopWindow() ), ; //- fhTaskBar() )
         WndWidth( ( GetDesktopWindow() ) ) ;
        PIXEL ;
        TITLE "Button";
        STYLE nOR( WS_POPUP );
        NOSYSMENU 
         
ACTIVATE WINDOW  oWndMain ;
ON INIT SHOW_BTN(oWndMain)

Return NIL

// -----------------

FUNCTION SHOW_BTN(oWndMain)
LOCAL oBrush, oBtnA

DEFINE BRUSH oBrush COLOR 0 // Black
SET BRUSH OF oWndMain TO oBrush
RELEASE BRUSH oBrush

@ 10,10 BTNBMP oBtnA  OF oWndMain FILENAME c_path + "\Images\Button1.bmp" SIZE  80, 80 ;
CENTER PIXEL ADJUST NOBORDER
oBtnA:lTransparent := .T.

RETURN NIL
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
Re: BtnBmp
Posted: Sun Sep 04, 2011 09:56 PM

That made it with BtnBmp, thanks Uwe, and one more thanks for all the great tools you facilitate to this forum...

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
Re: BtnBmp
Posted: Sun Sep 04, 2011 10:45 PM
That Made it with the painting!!!

But is there any way to detect any changes in the control???

For Example, when the mouse is over it (lMOver becomes .T.), is there a way to detect this and run an action for it???

What I will like to do is set a Text color for every state of the control : Normal, Mouse Over it and Button Pressed...

With SBUTTON I could acheive this by just setting the button COLORS like this:

Code (fw): Select all Collapse
COLORS { |oBtnF| If( ! oBtnF:lActive, CLR_WHITE, If( oBtnF:lMouseOver, CLR_HGREEN, If( oBtnF:lPressed, CLR_HRED, CLR_WHITE ) ) ) }


Thanks for any help, because I have been looking in SOURCE\CLASSES\btnbmp.prg and can't find a way to doit automatically using SetColor()...

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: BtnBmp (SOLVED)
Posted: Wed Sep 07, 2011 02:20 PM
You can change the Button-textcolor on any other Control-action :



// --------------------

FUNCTION SHOW_BTN(oWndMain)

@ 200, 200 BTNBMP oBtnA OF oWndMain ;
SIZE 80, 80 PIXEL ;
NOBORDER ;
ADJUST ;
PROMPT "&Exit" ;
FILENAME c_path + "\Images\Button1.Bmp" ;
ACTION oWndMain:End() ;
FONT oFont[2] ;
CENTER
oBtnA:lTransparent := .t.
oBtnA:cToolTip = { "Exit Dialog","Exit", 1, CLR_BLACK, 14089979 }
oBtnA:SetColor( 16776960, ) // Startup

// ------------------

From the Explorerbar ( Mainwindow )
( The Buttons oBtnA.., oBtnB..., defined as STATIC )

oExBar = TExplorerBar():New(150, 0, 150, 830, oWndMain)
oPanel1 = oExBar:AddPanel( "One", c_path + "\Images\people.bmp" )
oPanel1:AddLink( "First item", { |o| oBtnA:SetColor( 65535, ), oBtnA:Refresh() }, ;
c_path + "\Images\additem.bmp")
oPanel1:AddLink( "Second item", { |o| oBtnA:SetColor( 11009871, ), oBtnA:Refresh() }, ;
c_path + "\Images\copy.bmp")
oPanel1:lSpecial = .T.
oPanel1:oFont := oFont[1]

RETURN NIL

Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
Re: BtnBmp (SOLVED)
Posted: Wed Sep 07, 2011 02:59 PM
Thanks Uwe for taking the time to answer, and sorry for not posting this message before, but I was able to get the changes that I needed by doing what I explain in the following post:

http://forums.fivetechsupport.com/viewtopic.php?f=22&t=22328#p118911

Thanks for your help, your insight is always welcome!!!!

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Continue the discussion