Page 1 of 1

BTNBMP from resource missing command COLOR ?

Posted: Sat Nov 25, 2017 6:37 pm
by ukoenig
Hello,

why there is no COLOR defined in BTNBMP from resource ?

#xcommand REDEFINE BTNBMP [<oBtn>] ;
...
....
[ GRADIENT <bGradColors> ];
???????????
[ <lGDIP: GDIP, GDIPLUS> ];

------------------

#xcommand @ <nRow>, <nCol> BTNBMP [<oBtn>] ;
[ GRADIENT <bGradColors> ];
[ COLOR <nClrFore> [,<nClrBack>] ] ;
[ <pixel: PIXEL> ] ;
[ <design: DESIGN> ] ;
[ <lGDIP: GDIP, GDIPLUS> ];

Question 2

how to change the color ( NO gradient ) on mouseover ?
I couldn't find any sample.

for gradient it works ( using vars from a dbf ) like

GRADIENT { | lMouseOver | If( ! lMouseOver,;
{ { nBPos[5], nBColA1[5], nBColB1[5] }, ;
{ nBPos[5], nBColB1[5], nBColA1[5] } }, ;
{ { nBPos[5], nBColA2[5], nBColB2[5] }, ;
{ nBPos[5], nBColB2[5], nBColA2[5] } } ) } UPDATE

I want a colorchange in buttonline 2 like for gradient in buttonline 1
( define and adjusing colors of buttongroups )
ROUND only works with style 2007 ?

for buttonline 2
I can use GRADIENT { | lMouseOver | If( ! lMouseOver,;
with only 2 colors but maybe there is another solution.

Image

regards
Uwe :?:

Re: BTNBMP from resource missing command COLOR ?

Posted: Sun Nov 26, 2017 2:30 pm
by nageswaragunupudi
In bGradient, we can specify solid colors also like:

bClrGrad := { |lMouseOver| If( lMouseOver, CLR_HRED, { { 1, CLR_BLUE, CLR_WHITE } } ) }

Re: BTNBMP from resource missing command COLOR ?

Posted: Mon Nov 27, 2017 11:30 am
by ukoenig
Mr. Rao,

Your sample works fine.
To change the textcolor as well I did the following changes
with a included Setcolor() :

GRADIENT { |lMouseOver| If( lMouseOver, ( oBtn:SetColor( 16777215, ), 255 ), ; // red with white text
{ { 1, (oBtn:SetColor( 0, ), 3067734 ), 3067734 } } ) } // green with black text

the gradient-solution

GRADIENT { | lMouseOver | If( ! lMouseOver, ;
( oBtn[1]:SetColor( 255, ), ; // red text
{ { 0.5, 3067734, 16777215 }, ; // gradient green - white
{ 0.5, 16777215, 3067734 } } ), ;
( oBtn[1]:SetColor( 8388608, ), ; // blue text
{ { 0.5, 255, 16777215 }, ; // gradient red - white
{ 0.5, 16777215, 255 } } ) ) } UPDATE

It works but I am not sure if to keep it as the final solution.

regards
Uwe :?:

Re: BTNBMP from resource missing command COLOR ?

Posted: Mon Nov 27, 2017 4:35 pm
by nageswaragunupudi
:nClrText := { |lMouseOver, oBtn| <color>( lMouseOver, oBtn ) }

Re: BTNBMP from resource missing command COLOR ?

Posted: Mon Nov 27, 2017 6:30 pm
by ukoenig
Thank You very much.
much better and shorter now :

Code: Select all | Expand


GRADIENT { |lMouseOver, oBtn| If( lMouseOver, ( oBtn:nClrText := 16777215, 255 ), ;
        { { 1, ( oBtn:nClrText := 0, 3067734 ), 3067734 } } ) }

--------------

GRADIENT { |lMouseOver, oBtn| If( ! lMouseOver, ;
( oBtn:nClrText := 255, ; // red text
{ { 0.5, 3067734, 16777215 }, ; // gradient green - white
{ 0.5, 16777215, 3067734 } } ), ;
( oBtn:nClrText := 255, ; // blue text
{ { 0.5, 255, 16777215 }, ; // gradient red - white
{ 0.5, 16777215, 255 } } ) ) } UPDATE

 


regards
Uwe

Re: BTNBMP from resource missing command COLOR ?

Posted: Mon Nov 27, 2017 11:40 pm
by nageswaragunupudi
Instead of:

Code: Select all | Expand


GRADIENT { |lMouseOver, oBtn| If( lMouseOver, ( oBtn:nClrText := 16777215, 255 ), ;
        { { 1, ( oBtn:nClrText := 0, 3067734 ), 3067734 } } ) }
 

Recommended:

Code: Select all | Expand


GRADIENT { |lMouseOver, oBtn| If( lMouseOver, 255, 3067734 ) }

:nClrText := { |lMouseOver,oBtn| If( lMouseOver, 16777215, 0 ) }
 


Instead of:

Code: Select all | Expand


GRADIENT { |lMouseOver, oBtn| If( ! lMouseOver, ;
( oBtn:nClrText := 255, ; // red text
{ { 0.5, 3067734, 16777215 }, ; // gradient green - white
{ 0.5, 16777215, 3067734 } } ), ;
( oBtn:nClrText := 255, ; // blue text
{ { 0.5, 255, 16777215 }, ; // gradient red - white
{ 0.5, 16777215, 255 } } ) ) } UPDATE
 

Recommended:

Code: Select all | Expand


GRADIENT { |lMouseOver, oBtn| If( ! lMouseOver, ;
{ { 0.5, 3067734, 16777215 }, ; // gradient green - white
{ 0.5, 16777215, 3067734 } } ), ;
{ { 0.5, 255, 16777215 }, ; // gradient red - white
{ 0.5, 16777215, 255 } } ) ) }

:nClrText := { |lMouseOver, oBtn| If( lMouseOver, CLR_HRED, CLR_BLUE ) }