FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour possible changing BtnBmp-gradient at runtime ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
possible changing BtnBmp-gradient at runtime ?
Posted: Fri Feb 13, 2015 01:08 AM
Is it possible to change the gradient of BtnBmp at runtime ?
I tested to change the color on button-action, but doesn't work.
Maybe I have to destroy the button and rebuild ?

The button I want to change the gradient :

REDEFINE BTNBMP oBtn[10] OF oDlg2 UPDATE ;
ID 900 PIXEL 2007 ;
NOBORDER ;
PROMPT "&BUTTON-test" ;
ACTION oDlg2:End() ;
FONT oFont1 ;
LEFT
oBtn[10]:lTransparent := .t.
oBtn[10]:cToolTip = { "Gradient" + CRLF + "Test","Button-gradient", 1, CLR_BLACK, 14089979 }
oBtn[10]:SetColor( 0, )
oBtn[10]:bClrGrad = { | lMouseOver | If( ! lMouseOver,;
{ { 0.50, 12434811, 16777215 }, ;
{ 0.50, 16777215, 12434811 } }, ;
{ { 0.50, 255, 16777215 }, ;
{ 0.50, 16777215, 255 } } ) }


New colors of button 10 on action of button 3

REDEFINE BTNBMP oBtn[3] OF oDlg2 ;
ID 230 PIXEL 2007 ;
NOBORDER ;
PROMPT "&1. Color " ;
FILENAME c_path1 + "Paint.Bmp" ;
ACTION ( nBColorF1 := ChooseColor(), oBmp[4]:Refresh(), ;
oBtn[10]:EraseBkGnd( hDC ), ; // NO effect !
oBtn[10]:bClrGrad = { | lMouseOver | If( ! lMouseOver,;
{ { 0.50, nBColorF1, nBColorB1 }, ;
{ 0.50, nBColorB1, nBColorF1 } }, ;
{ { 0.50, nBColorF2, nBColorB2 }, ;
{ 0.50, nBColorB2, nBColorF2 } } ) }, ;
oBtn[10]:Refresh(),
) ; // NO effect !!!
FONT oFont1 ;
LEFT
oBtn[3]:lTransparent := .t.
oBtn[3]:cToolTip = { "1. Button-Gradient" + CRLF + "Color","Color-Selection", 1, CLR_BLACK, 14089979 }
oBtn[3]:SetColor( 0, )

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: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: possible changing BtnBmp-gradient at runtime ?
Posted: Fri Feb 13, 2015 01:11 AM

You can change at runtime. You do not need to rebuild the button.

Regards



G. N. Rao.

Hyderabad, India
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: possible changing BtnBmp-gradient at runtime ?
Posted: Fri Feb 13, 2015 01:44 AM
That is, what I'm trying to do :
( the dialog I'm working on )

The original button-colors



The changed colors. No refresh of the testbutton.



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: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: possible changing BtnBmp-gradient at runtime ?
Posted: Fri Feb 13, 2015 09:32 AM
Mr. Rao,

it works fine now.
Just a symple REFRESH needed. I forgot using vars inside the testbutton.
( late at night, I lost my concentration )

The used vars :

nBColorF1 := 12434811
nBColorB1 := 16777215
nBGradPos1 := 0.50
nBColorF2 := 255
nBColorB2 := 16777215
nBGradPos2 := 0.50


REDEFINE BTNBMP oBtn[10] OF oDlg2 UPDATE ;
ID 900 PIXEL 2007 ;
NOBORDER ;
PROMPT "&BUTTON-test" ;
ACTION oDlg2:End() ;
FONT oFont1 ;
LEFT
oBtn[10]:lTransparent := .t.
oBtn[10]:cToolTip = { "Gradient" + CRLF + "Test","Button-gradient", 1, CLR_BLACK, 14089979 }
oBtn[10]:SetColor( 0, )
oBtn[10]:bClrGrad = { | lMouseOver | If( ! lMouseOver,;
{ { nBGradPos1, nBColorF1, nBColorB1 }, ;
{ nBGradPos1, nBColorB1, nBColorF1 } }, ;
{ { nBGradPos2, nBColorF2, nBColorB2 }, ;
{ nBGradPos2, nBColorB2, nBColorF2 } } ) }


Selections ( 4 colors ) from button 3 - 6

REDEFINE BTNBMP oBtn[3] OF oDlg2 ;
ID 230 PIXEL 2007 ;
NOBORDER ;
PROMPT "&1. Color " ;
FILENAME c_path1 + "Paint.Bmp" ;
ACTION ( nBColorF1 := ChooseColor(), oBmp[4]:Refresh(), ;
oBtn[10]:Refresh() , oBMP[6]:Refresh(), oGet[3]:Refresh() ) ;
FONT oFont1 ;
LEFT
oBtn[3]:lTransparent := .t.
oBtn[3]:cToolTip = { "1. Dlg-Gradient" + CRLF + "Color","Color-Selection", 1, CLR_BLACK, 14089979 }
oBtn[3]:SetColor( 0, )

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.

Continue the discussion