Antonio Linares wrote:Dear Silvio,
Maybe replacing the bitmap with another with different color ?
Function ChangePressedBtn(oBtn)
local bClrGradSelect := {| lPressed | if( lPressed ,;
{ ;
{2/5, nRGB( 253,212,168 ), nRGB( 251,178,99 ) },;
{3/5, nRGB( 250,157,52 ), nRGB( 252,234,163 ) };
},;
{ ;
{2/5, nRGB( 245,177,110 ), nRGB( 243,165,89 ) },;
{3/5, nRGB( 216,136,52 ), nRGB( 249,202,98 ) } ;
} ) }
local bClrGradNormal := { | lPressed | if ( lPressed,;
{ ;
{ 2/5, RGB( 194, 213, 242 ), RGB( 194, 213, 242 ) } , ;
{ 3/5, RGB( 194, 213, 242 ), RGB( 194, 213, 242 ) } ;
},;
{;
{ 2/5, nRGB( 201, 224, 247 ), nRGB( 201, 224, 247 ) } , ;
{ 3/5, nRGB( 201, 224, 247 ), nRGB( 201, 224, 247 ) } ;
} ) }
oBtn:lPressed:=!oBtn:lPressed
? oBtn:lPressed
If oBtn:lPressed
oBtn:bClrGrad := bClrGradSelect
else
oBtn:bClrGrad := bClrGradNormal
Endif
oBtn:refresh()
return nil
#include "fivewin.ch"
Function test()
local oWnd
local oBar,oPlus,oNumber,oCancel
DEFINE WINDOW oWnd
DEFINE BUTTONBAR oBar TOP OF oWnd 2015
DEFINE BUTTON oNumber FILENAME "one.bmp" OF oBar ;
TOOLTIP "one n umber" ;
ACTION ChangePressedBtn(oNumber)
DEFINE BUTTON oPlus FILENAME "plus.bmp" OF oBar ;
TOOLTIP "plus numbers" ;
ACTION ChangePressedBtn(oPlus)
DEFINE BUTTON oCancel FILENAME "delete.bmp" OF oBar ;
TOOLTIP "cancel" ;
ACTION (ChangePressedBtn(oPlus),;
ChangePressedBtn(oNumber) )
ACTIVATE WINDOW oWnd
RETURN NIL
//---------------------------------------------------------------------//
Function ChangePressedBtn(oBtn)
local bClrGradSelect := { | lInvert | If( ! lInvert,;
{ { 1, RGB( 244, 244, 245 ), RGB( 244, 244, 245 ) } },;
{ { 1, RGB( 255, 253, 222 ), RGB( 255, 231, 151 ) } } ) }
local bClrGradNormal := { | lInvert | If( ! lInvert,;
{ { 1, RGB( 244, 244, 245 ), RGB( 244, 244, 245 ) } },;
{ { 1, RGB( 145, 201, 247 ), RGB( 145, 201, 247 ) } } ) }
oBtn:Toggle()
If oBtn:lPressed
oBtn:bClrGrad := bClrGradSelect
else
oBtn:bClrGrad := bClrGradNormal
Endif
oBtn:refresh()
return ni
// C:\FWH..\SAMPLES\GRADSIL.PRG
#include "FiveWin.ch"
#define K_F5 (-4)
#Define aPubGrad {| lInvert | If( lInvert, ;
{ { 1 / 3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
{ 2 / 3, nRGB( 255, 215, 84 ), nRGB( 255, 233, 162 ) } ;
}, ;
{ { 1 / 2, nRGB( 219, 230, 244 ), nRGB( 207 - 50, 221 - 25, 255 ) }, ;
{ 1 / 2, nRGB( 201 - 50, 217 - 25, 255 ), nRGB( 231, 242, 255 ) } ;
} ) }
STATIC oWnd, oBmp, oBtn1, oBtn2, oBtn3, oBtn4, oBtn5, oBtn6, oBtn7, oBtn8, oBtn9
function Main()
local oBrush, oBar, hDLL
local oSkinB
SET _3DLOOK ON
oSkinB = TSkinButton():New()
oSkinB:nClrBorder0_N = RGB( 249, 194, 179 )
oSkinB:nClrBorder1_N = RGB( 181, 61, 29 )
oSkinB:aClrNormal = { { 0.2, RGB( 254, 154, 128 ), RGB( 254, 154, 128 ) }, ;
{ 0.8, RGB( 252, 85, 40 ), RGB( 181, 61, 29 ) } }
SkinButtons( oSkinB )
// don't use VK_F5 because VK_F5 and 't' have the same code !
// for VK_F5 use Clipper's K_F5
SetKey( K_F5, { || MsgInfo( "Testing SetKey feature..." ) } )
DEFINE BRUSH oBrush STYLE BORLAND
DEFINE WINDOW oWnd FROM 1, 5 TO 20, 75 BRUSH oBrush ;
TITLE "Cambiar los colores de los botones de ButtonBar" ;
MENU BuildMenu()
DEFINE BUTTONBAR oBar _3D SIZE 31, 33 OF oWnd // 2007 // no use 2007/2015
WITH OBJECT oBar // VER: ANCHO.PRG
oBar:bClrGrad := aPubGrad
oBar:bRClicked := { || NIL } // Botao direito do Mouse desligado.
oBar:bLClicked := { || NIL } // Botao Esquerdo do Mouse desligado.
// oBar:SetFont( oFont )
// Cor no Prompt dos Botoes
// oBar:nClrText := CLR_HBLUE // BLACK
oBar:Adjust()
END
DEFINE BUTTON oBtn1 FILE "..\bitmaps\Select.bmp" OF oBar ;
MESSAGE "Testing a sample selection dialog" NOBORDER ;
TOOLTIP "Selection Dialog"
DEFINE BUTTON oBtn2 FILE "..\bitmaps\Edit.bmp" OF oBar ;
MESSAGE "Testing a typical bussiness dialog" NOBORDER ;
TOOLTIP "Images DataBase"
DEFINE BUTTON oBtn3 FILE "..\bitmaps\Browse.bmp" OF oBar ;
MESSAGE "Easy and powerfull Browsers" NOBORDER ;
TOOLTIP "Browse"
DEFINE BUTTON oBtn4 FILE "..\bitmaps\Exit.bmp" OF oBar ;
ACTION _Exit() MESSAGE "When you want to end" NOBORDER ;
TOOLTIP "Exit"
DEFINE BUTTON oBtn5 FILE "..\bitmaps\Colors.bmp" OF oBar ;
ACTION ChooseColor() GROUP ;
MESSAGE "Calling Windows standard color selection dialog" NOBORDER ;
TOOLTIP "Colors"
DEFINE BUTTON oBtn6 FILE "..\bitmaps\Dlg.bmp" OF oBar ;
ACTION cGetFile( "*.dbf", "Select a DBF" ) ;
MESSAGE "Calling Windows standard Get a File dialog" NOBORDER ;
TOOLTIP "GetFile"
DEFINE BUTTON oBtn7 FILE "..\bitmaps\Fonts.bmp" OF oBar ACTION ChooseFont() ;
MESSAGE "Calling Windows standard font selection dialog" NOBORDER ;
TOOLTIP "GetFont"
DEFINE BUTTON oBtn8 FILE "..\bitmaps\Blocks.bmp" OF oBar GROUP ;
MESSAGE "About FiveWin designers" NOBORDER ;
TOOLTIP "About"
DEFINE BUTTON oBtn9 FILE "..\bitmaps\Open.bmp" OF oBar ;
ACTION CAMBIA_COLOR() MESSAGE "Cambiar colores de los Buttons" NOBORDER ;
TOOLTIP "Cambiar colores de los Buttons"
// @ 6, 18 BITMAP oBmp FILENAME "..\bitmaps\Luck.bmp" OF oWnd
DEFINE BITMAP oBmp FILENAME "..\bitmaps\fiveback.bmp"
oWnd:bPainted = { | hDC | BmpTiled( hDC, oWnd, oBmp ) }
SET MESSAGE OF oWnd ;
TO "FiveWin - Cambiar los colores de los botones de ButtonBar!" ;
CENTERED 2007
ACTIVATE WINDOW oWnd MAXIMIZED
return nil
FUNCTION CAMBIA_COLOR()
LOCAL nCor
nCor := ChooseColor()
oBtn1:nClrText := nCor
oBtn1:nClrPane := nCor
oBtn2:nClrText := nCor
oBtn2:nClrPane := nCor
oBtn3:nClrText := nCor
oBtn3:nClrPane := nCor
oBtn4:nClrText := nCor
oBtn4:nClrPane := nCor
oBtn5:nClrText := nCor
oBtn5:nClrPane := nCor
oBtn6:nClrText := nCor
oBtn6:nClrPane := nCor
oBtn7:nClrText := nCor
oBtn7:nClrPane := nCor
oBtn8:nClrText := nCor
oBtn8:nClrPane := nCor
oBtn9:nClrText := nCor
oBtn9:nClrPane := nCor
RETURN NIL
function BuildMenu()
local oMenu
MENU oMenu 2007
MENUITEM "Some &Dialogs"
MENU
MENUITEM "Make a selection..." ;
MESSAGE "It's time to start building Windows applications easily!"
MENUITEM "Now you have a real chance..." ;
MESSAGE "Quick and easy Windows applications using your Clipper!!!"
SEPARATOR
MENUITEM "End..." MESSAGE "Exit this demo" ACTION _Exit() // UDF
ENDMENU
MENUITEM "Some &Standards..."
MENU
MENUITEM "Choose A &Color..." ;
MESSAGE "Calling standard Windows dialogs" ACTION ChooseColor()
MENUITEM "Getting a &file..." ;
MESSAGE "Hey, see how easy this is" ;
ACTION cGetFile( "*.dbf", "Select a DBF" )
MENUITEM "Selecting a f&ont..." ;
MESSAGE "Any Windows facility is ready for you" ;
ACTION ChooseFont()
ENDMENU
MENUITEM "About..." ;
MESSAGE "Come on... we would like to see your name here soon!"
ENDMENU
return oMenu
function _Exit()
oWnd:End()
return nil
STATIC FUNCTION BmpTiled( hDC, oWnd, oBmp )
local nWidth := oWnd:nWidth(), nHeight := oWnd:nHeight()
local nRow := 0, nCol := 0, n
local nBmpWidth := oBmp:nWidth(), nBmpHeight := oBmp:nHeight()
if oBmp:hBitmap == 0
return nil
endif
while nRow < nHeight
nCol = 0
while nCol < nWidth
PalBmpDraw( hDC, nRow, nCol, oBmp:hBitmap )
nCol += nBmpWidth
end
nRow += nBmpHeight
end
return nil
// FIN / END
#include "fivewin.ch"
Function test()
local oWnd
local oBar,oPlus,oNumber,oCancel
local lNumber:=nil
DEFINE WINDOW oWnd
DEFINE BUTTONBAR oBar TOP OF oWnd 2015
DEFINE BUTTON oNumber FILENAME "one.bmp" OF oBar ;
TOOLTIP "one number" ;
ACTION ( ChangePressedBtn(oNumber), lNumber:=.f.)
DEFINE BUTTON oPlus FILENAME "plus.bmp" OF oBar ;
TOOLTIP "plus numbers" ;
ACTION (ChangePressedBtn(oPlus), lNumber:=.t.)
DEFINE BUTTON oCancel FILENAME "delete.bmp" OF oBar ;
TOOLTIP "cancel" ;
ACTION AnnullaSelezione(oPlus,oNumber,lNumber)
ACTIVATE WINDOW oWnd
RETURN NIL
//---------------------------------------------------------------------//
Function ChangePressedBtn(oBtn)
local bClrGradSelect := { | lInvert | If( ! lInvert,;
{ { 1, RGB( 244, 244, 245 ), RGB( 244, 244, 245 ) } },;
{ { 1, RGB( 255, 253, 222 ), RGB( 255, 231, 151 ) } } ) }
local bClrGradNormal := { | lInvert | If( ! lInvert,;
{ { 1, RGB( 244, 244, 245 ), RGB( 244, 244, 245 ) } },;
{ { 1, RGB( 145, 201, 247 ), RGB( 145, 201, 247 ) } } ) }
oBtn:Toggle()
If oBtn:lPressed
oBtn:bClrGrad := bClrGradSelect
else
oBtn:bClrGrad := bClrGradNormal
Endif
oBtn:refresh()
return nil
//--------------------------------------------------------//
Function AnnullaSelezione(oPlus,oNumber,lNumber)
IF lNumber !=nil
IF lNumber
ChangePressedBtn(oPlus)
Endif
IF !lNumber
ChangePressedBtn(oNumber)
Endif
oPlus:refresh()
oNumber:refresh()
Endif
return nil
//--------------------------------------------------------/
// C:\FWH..\SAMPLES\GRADSIL2.PRG
#Include "FiveWin.ch"
#Define GRAD_BTN_BLACK { | lInvert | If( ! lInvert, ;
{ { 0.70,0 ,12429486 },{ 0.70,12429486,0 } },;
{ { 0.40,9928844,12429486 },{ 0.40,12429486,9928844 } } ) }
#Define aPubGrad { | lInvert | If( lInvert, ;
{ { 1/3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
{ 2/3, nRGB( 255, 215, 84 ), nRGB( 255, 233, 162 ) } ;
}, ;
{ { 1/2, nRGB( 219, 230, 244 ), nRGB( 207-50, 221-25, 255 ) }, ;
{ 1/2, nRGB( 201-50, 217-25, 255 ), nRGB( 231, 242, 255 ) } ;
} ) }
#Define aPubRedGr { | lInvert | If( ! lInvert, { { 0.50,16776960,16777215 }, ;
{ 0.50,16777215,16776960 } }, { { 0.50,128,16777215 }, ;
{ 0.50,16777215,128 } } ) }
#Define bGrad { | lInvert | If( ! lInvert, ;
{ { 1, nRGB( 255, 255, 255 ), nRGB( 230, 234, 239 ) } }, ;
{ { 1/3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
{ 2/3, nRGB( 255, 215, 84 ), nRGB( 255, 233, 162 ) } ;
} ) }
FUNCTION Test()
LOCAL oWnd
LOCAL oBar, oPlus, oNumber, oCancel, oExit
LOCAL lNumber := nil
DEFINE WINDOW oWnd
DEFINE BUTTONBAR oBar TOP OF oWnd 2015
DEFINE BUTTON oNumber FILENAME "..\bitmaps\16x16\floppy.bmp" OF oBar ;
TOOLTIP "one number" ;
ACTION ( ChangePressedBtn( oNumber ), lNumber := .F. )
DEFINE BUTTON oPlus FILENAME "..\bitmaps\16x16\plus.bmp" OF oBar ;
TOOLTIP "plus numbers" ;
ACTION ( ChangePressedBtn( oPlus ), lNumber := .T. )
DEFINE BUTTON oCancel FILENAME "..\bitmaps\16x16\delete.bmp" OF oBar ;
TOOLTIP "cancel" ;
ACTION AnnullaSelezione( oPlus, oNumber, lNumber )
DEFINE BUTTON oExit FILENAME "..\bitmaps\16x16\exit.bmp" OF oBar ;
TOOLTIP "Salida - Exit - Cancelar" ;
ACTION( oWnd:End() )
ACTIVATE WINDOW oWnd
RETURN NIL
FUNCTION ChangePressedBtn( oBtn )
LOCAL bClrGradSelect := { | lInvert | If( ! lInvert, ;
{ { 1, RGB( 244, 244, 245 ), RGB( 244, 244, 245 ) } }, ;
{ { 1, RGB( 255, 253, 222 ), RGB( 255, 231, 151 ) } } ) }
LOCAL bClrGradNormal := { | lInvert | If( ! lInvert, ;
{ { 1, RGB( 244, 244, 245 ), RGB( 244, 244, 245 ) } }, ;
{ { 1, RGB( 145, 201, 247 ), RGB( 145, 201, 247 ) } } ) }
oBtn:Toggle()
IF oBtn:lPressed
// bGrad-aPubRedGr-aPubGrad-bClrGradSelect
oBtn:bClrGrad := GRAD_BTN_BLACK // Bello.
ELSE
oBtn:bClrGrad := bClrGradNormal
ENDIF
oBtn:refresh()
RETURN NIL
FUNCTION AnnullaSelezione( oPlus, oNumber, lNumber )
IF lNumber != nil
IF lNumber
ChangePressedBtn( oPlus )
ENDIF
IF !lNumber
ChangePressedBtn( oNumber )
ENDIF
oPlus:refresh()
oNumber:refresh()
ENDIF
RETURN NIL
// FIN / END
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 109 guests