BtnBmp (SOLVED)

BtnBmp (SOLVED)

Postby Bayron » Sun Sep 04, 2011 6:13 am

Hi you all,

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

Image

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!!!
Last edited by Bayron on Tue Sep 06, 2011 6:28 pm, edited 1 time in total.
=====>

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

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: BtnBmp

Postby stefano » Sun Sep 04, 2011 3:27 pm

test with
oBtnbmp:lTRANSPARENT = .T.

saluti
Stefano
FWH 14.11 + xHarbour + bcc582
stefano
 
Posts: 80
Joined: Tue Mar 25, 2008 9:03 pm
Location: ITALIA

Re: BtnBmp

Postby Bayron » Sun Sep 04, 2011 3: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
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: BtnBmp

Postby ukoenig » Sun Sep 04, 2011 3:53 pm

I included this Button, but cannot discover such Effect.
Maybe the way the Background is defined ?

Image

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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: BtnBmp

Postby Bayron » Sun Sep 04, 2011 4:17 pm

This is the way I define the control:

Code: Select all  Expand view
@ ( 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
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: BtnBmp

Postby stefano » Sun Sep 04, 2011 4: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:oBrush:hBrush )
oDlgkK:oBrush:hBitmap = hBmp
oDlgkK:oBrush: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
stefano
 
Posts: 80
Joined: Tue Mar 25, 2008 9:03 pm
Location: ITALIA

Re: BtnBmp

Postby Bayron » Sun Sep 04, 2011 5: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: Select all  Expand view
#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
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: BtnBmp

Postby ukoenig » Sun Sep 04, 2011 6: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: Select all  Expand view

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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: BtnBmp

Postby Bayron » Sun Sep 04, 2011 9: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
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: BtnBmp

Postby Bayron » 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: Select all  Expand view
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
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: BtnBmp (SOLVED)

Postby ukoenig » Wed Sep 07, 2011 2:20 pm

You can change the Button-textcolor on any other Control-action :

Image

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

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 :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: BtnBmp (SOLVED)

Postby Bayron » Wed Sep 07, 2011 2: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
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 51 guests