change color

change color

Postby Silvio.Falconi » Sat Aug 25, 2018 12:45 am

I have a btnbmp with no image

@ nrow, ncol BTNBMP aBmps[ nY, nX ] OF oDlg SIZE BMP_H, BMP_V PIXEL

can I fill the btnbmp with a color on a second moment?

I tried with setcolor or bpainted and it not run

also with aBmps[ nY, nX ]:bClrGrad := { |l,oBtn| CLR_GREEN }

I must change the color on each button with condition

for a sample if on aData[ nY, nX ] = "O" clr_red if = "X" clr_gray


any solution ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7057
Joined: Thu Oct 18, 2012 7:17 pm

Re: change color

Postby ukoenig » Sat Aug 25, 2018 8:31 pm

Just try this small test
The button-actions can be any condition
The button < dark > changes the colors of button 1 and 2 to dark red
The button < normal > switches back to normal

Image

Code: Select all  Expand view

#include "FiveWin.ch"

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

STATIC oDlg

FUNCTION MAIN()
local oBtn1, oBtn2, oBtn3, oBtn4, aColor[4]

aColor[1] := 10526975
aColor[2] := 16777215  
aColor[3] := 16768185  
aColor[4] := 255                

DEFINE DIALOG oDlg SIZE 400, 400  

@ 30, 30 BTNBMP oBtn1 ;
SIZE 50, 30 OF oDlg NOBORDER ;
ACTION MsgInfo( "click" )

oBtn1:bClrGrad = { | lMouseOver | If( ! lMouseOver,;
    { { 0.5, aColor[1], aColor[2] }, ;
      { 0.5, aColor[2], aColor[1] } }, ;
    { { 0.5, aColor[3], aColor[1] }, ;
       { 0.5, aColor[1], aColor[3] } } ) }

@ 30, 120 BTNBMP oBtn2 ;
SIZE 50, 30 OF oDlg NOBORDER ;
ACTION MsgInfo( "click" )
   
oBtn2:bClrGrad = { | lMouseOver | If( ! lMouseOver,;
    { { 0.5, aColor[1], aColor[2] }, ;
      { 0.5, aColor[2], aColor[1] } }, ;
    { { 0.5, aColor[3], aColor[1] }, ;
      { 0.5, aColor[1], aColor[3] } } ) }  
 
@ 90, 30 BTNBMP oBtn3 ;
SIZE 50, 30 OF oDlg NOBORDER ;
PROMPT "&Normal" ;
ACTION ( aColor[1] := 10526975, oBtn1:Refresh(), oBtn2:Refresh() ) ;  // back to normal
CENTER

oBtn3:bClrGrad = { | lMouseOver | If( ! lMouseOver,;
    { { 0.5, 10526975, 16777215 }, ;
      { 0.5, 16777215, 10526975 } }, ;
    { { 0.5, 16768185, 10526975 }, ;
       { 0.5, 10526975, 16768185 } } ) }

@ 90, 120 BTNBMP oBtn4 ;
SIZE 50, 30 OF oDlg NOBORDER ;
PROMPT "&Dark" ;
ACTION ( aColor[1] := aColor[4], oBtn1:Refresh(), oBtn2:Refresh() ) ;   // change to dark red 
CENTER

oBtn4:bClrGrad = { | lMouseOver | If( ! lMouseOver,;
    { { 0.5, 10526975, 16777215 }, ;
      { 0.5, 16777215, 10526975 } }, ;
    { { 0.5, 16768185, 10526975 }, ;
       { 0.5, 10526975, 16768185 } } ) }

ACTIVATE DIALOG oDlg CENTERED

RETURN NIL
 


regards
Uwe :D
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: change color

Postby Silvio.Falconi » Sat Aug 25, 2018 10:45 pm

I resolved !!!
the problem was I use ltransparent:=.t. when I change the colors of btnbmp this not was changed
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7057
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 68 guests