1) Normal color
2) Mouse Over or Pressed
If we want to have 3 colors
1) Normal Color
2) Pressed
3) Mouse Over
please try this sample and adopt:
- Code: Select all Expand view
- #include "fivewin.ch"
function Btntest()
local oWnd
DEFINE WINDOW oWnd
DEFINE BUTTONBAR oWnd:oBar SIZE 32,32 2015
oWnd:oBar:bClrGrad := < |lInvert, oBtn|
if oBtn != nil .and. oBtn:IsKindOf( "TBTNBMP" ) .and. oBtn:lPressed
return { { 1/3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ; // Any clr grad of your choice
{ 2/3, nRGB( 255, 215, 84 ), nRGB( 255, 233, 162 ) } }
elseif lInvert
return { { 1, RGB( 145, 201, 247 ), RGB( 145, 201, 247 ) } } // 2015 : invert
endif
return { { 1, RGB( 244, 244, 245 ), RGB( 244, 244, 245 ) } } // 2015 normal
>
DEFINE BUTTON OF oWnd:oBar FILE "\fwh\bitmaps\16x16\new2.bmp" ACTION BtnAction( This )
DEFINE BUTTON OF oWnd:oBar FILE "\fwh\bitmaps\16x16\open3.bmp" ACTION BtnAction( This )
DEFINE BUTTON OF oWnd:oBar FILE "\fwh\bitmaps\16x16\zoom2.bmp" ACTION BtnAction( This )
DEFINE BUTTON OF oWnd:oBar FILE "\fwh\bitmaps\16x16\printer.bmp" ACTION BtnAction( This )
ACTIVATE WINDOW oWnd CENTERED
return nil
static function BtnAction( oBtn )
AEval( oBtn:oWnd:aControls, { |o| If( o:IsKindOf( "TBTNBMP" ), o:lPressed := .f., nil ) } )
oBtn:lPressed := .t.
oBtn:oWnd:Refresh()
return nil
In the above, button 3 is pressed earlier and mouse is now over 1st button.