#include "fivewin.ch"
procedure main()
local oDlgw
local oBot01, oBot02, oBot03, oBot04
local lWhen := .f.
local oFont
local oBar, oBotBar1, oBotBar2, oBotBar3, oBotBar4, oBotBar5, oBotBar6, oBotBar7, oBotBar0
local ahOver := PalBmpRead( , "..\bitmaps\butt1upL.bmp" )
local ahOldBmp := array( 2 )
local bGrad
bGrad := { | lInvert | If( lInvert, ;
{ { 1/2, nRGB( 219, 230, 244 ), nRGB( 207-50, 221-25, 255 ) }, ;
{ 1/2, nRGB( 201-50, 217-25, 255 ), nRGB( 231, 242, 255 ) } ;
}, ;
{ { 1/2, nRGB( 219, 230, 244 ), nRGB( 207-50, 221-25, 255 ) }, ;
{ 1/2, nRGB( 201-50, 217-25, 255 ), nRGB( 231, 242, 255 ) } ;
} ) }
SetBalloon( .t. )
DEFINE window oDlgw TITLE "Test BTNBMP" from 0,0 to 600,750 pixel
define buttonbar oBar of oDlgw size 110, 40 2007
define font oFont name "ARIAL" size -10,0
define button oBotBar0 of oBar file "..\bitmaps\off.bmp","..\bitmaps\on.bmp","..\bitmaps\dis.bmp","..\bitmaps\ene.bmp" PROMPT "Files" left
define button oBotBar1 of oBar file "..\bitmaps\off.bmp", "..\bitmaps\on.bmp",nil,"..\bitmaps\ene.bmp" ;
tooltip "USO ::lBoxSelect DESACTIVADO"
define button oBotBar2 of oBar file "..\bitmaps\off.bmp", "..\bitmaps\on.bmp",nil,"..\bitmaps\ene.bmp" noborder;
tooltip "USO ::lBoxSelect ACTIVADO"
define button oBotBar3 of oBar file "..\bitmaps\butt1upD.bmp", "..\bitmaps\butt1do.bmp",nil,"..\bitmaps\butt1upL.bmp" noborder;
tooltip "USO ::lBoxSelect DESACTIVADO"
//----------- TESTING DISABLED -----------
define button oBotBar4 of oBar file "..\bitmaps\cara.bmp" adjust;
tooltip "Con ADJUST"
// Works
@ 0, 570 BTNBMP oBotBar5 OF oBar ;
SIZE 60, 40 PIXEL ;
BORDER ;
PROMPT "E&nd" ;
FILENAME "..\bitmaps\cara.bmp"
// doesn*t work
@ 0, 650 BTNBMP oBotBar6 OF oBar ;
SIZE 60, 40 PIXEL ;
BORDER ;
PROMPT "E&nd" ;
FILENAME "..\bitmaps\cara.bmp"
oBotBar4:Disable() // works
oBotBar6:Disable() // doesn*t work
// -----------
oBotBar0:bClrGrad := { | 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 ) } ;
} ) }
oBotBar1:bClrGrad := bGrad
oBotBar2:bClrGrad := bGrad
oBotBar3:bClrGrad := bGrad
oBotBar1:lBoxSelect := .f.
oBotBar3:lBoxSelect := .f.
@ 100, 5 BTNBMP oBot01 OF oDlgw SIZE 200, 70 WHEN lWhen ;
font oFont file "..\bitmaps\off.bmp", "..\bitmaps\on.bmp","..\bitmaps\DIS.BMP" right
@ 250, 5 BTNBMP oBot02 OF oDlgw SIZE 200, 70 noborder ADJUST TRANSPARENT;
file "..\bitmaps\butt1upD.bmp", "..\bitmaps\butt1do.bmp",nil,"..\bitmaps\butt1upL.bmp" font oFont;
action ( if( (lWhen := !lWhen), oBot01:SetText( "&Test" ), oBot01:SetText( "" ) ), oBot01:refresh() );
tooltip "Presione para Activar/Desactivar Boton Anterior"
@ 350, 5 BTNBMP oBot03 OF oDlgw SIZE 90, 70 noborder ;
file "..\bitmaps\butt3up.bmp", "..\bitmaps\butt3do.bmp" adjust tooltip "Activa/Descativa 1er boton de la barra";
action ( if ( ! IsWindowEnabled( oBotBar0:hWnd ), oBotBar0:enable(), oBotBar0:disable() ) )
@ 450, 5 BTNBMP oBot04 PROMPT "Test &2" OF oDlgw SIZE 200, 70 WHEN lWhen ;
file "..\bitmaps\butt2up.bmp", "..\bitmaps\butt2do.bmp", "..\bitmaps\dis.bmp" adjust font ofont
oBot02:bGotFocus := {|| ahOldBmp[ 1 ] := oBot02:hBitmap1, ;
ahOldBmp[ 2 ] := oBot02:hPalette1,;
oBot02:hBitmap1 := ahOver[ 1 ],;
oBot02:hPalette1 := ahOver[ 2 ],;
oBot02:refresh() }
oBot02:bLostFocus := {||oBot02:hBitmap1 := ahOldBmp[ 1 ],;
oBot02:hPalette1 := ahOldBmp[ 2 ],;
afill( ahOldBmp, NIL ),;
oBot02:refresh() }
oBot01:SetColor( CLR_BLACK, CLR_CYAN )
ACTIVATE window oDlgw on init oBot02:setfocus()
return