Using my old FWH, (xHb+FWH1411), disabled buttons at oBar is greyed out as expected.
After I link with newer HB+FWH1912 the disabled buttons are not greyed out anymore.
Any tip on what should I be checking?
TIA
DEFINE BUTTON oBtn OF oBar FILE "..\bitmaps\cara.bmp" MESSAGE "Create a new project" ;
ACTION MsgInfo( "New Project", "Information" ) when .f.
....
ACTIVATE WINDOW oWnd on init oBtn:disable()
ACTIVATE WINDOW oWnd ON INIT( oBtn:disable(), oBtn:Refresh() )
karinha wrote:oBtn is LOCAL or STATIC?
DEFINE BUTTON oBtnB_Top RESOURCE "B_TOP","B_TOP","B_GREY","B_TOP" OF oBar GROUP
#xcommand DEFINE BUTTON [ <oBtn> ] ;
[ <bar: OF, BUTTONBAR > <oBar> ] ;
[ <resource: NAME, RESNAME, RESOURCE> <cResName1> ;
[,<cResName2>[,<cResName3>[,<cResName4>] ] ] ] ;
[ <file: FILE, FILENAME, DISK> <cBmpFile1> ;
[,<cBmpFile2>[,<cBmpFile3>[,<cBmpFile4>] ] ] ] ;
[ <action:ACTION,EXEC> <uAction,...> ] ;
[ <group: GROUP > [ LABEL <label> [ COLORS <nLblFore>, <nLblBack> ] ] ] ;
[ MESSAGE <cMsg> ] ;
[ <adjust: ADJUST > ] ;
[ WHEN <WhenFunc> ] ;
[ TOOLTIP <cToolTip> ] ;
[ <lPressed: PRESSED> ] ;
[ ON DROP <bDrop> ] ;
[ AT <nPos> ] ;
[ PROMPT <cPrompt> ] ;
[ FONT <oFont> ] ;
[ <lNoBorder: NOBORDER, FLAT> ] ;
[ MENU <oPopup> ] ;
[ <layout: CENTER, TOP, LEFT, BOTTOM, RIGHT> ] ;
[ <lTrans: TRANSPARENT>];
[ <lRight: BTNRIGHT> ];
Is it Normal, Pressed, Inactive and Mouse Over?
lPalBtnPaint := .t.
return nil
endif
//
if lGray
BtnDisable( ::hWnd, ::hDC )
endif
if lGray
BtnDisable( ::hWnd, ::hDC )
endif
lPalBtnPaint := .t.
return nil
endif
//
::DrawImage( ::aImages[ ::nBmpNo ], aBmpRect, ::lBmpTransparent, uResize, ;
If( ::lAlpha, ::nAlphaLevel, .f. ), lGray, nil, aColorMap )
::DrawImage( ::aImages[ ::nBmpNo ], aBmpRect, ::lBmpTransparent, uResize, ;
If( lGray, 100, If( ::lAlpha, ::nAlphaLevel, .f. ) ), ;
lGray, nil, aColorMap )
// C:\FWH\SAMPLES\TESTBAR4.PRG and TESTABAR4.RC
#Include "FiveWin.ch"
STATIC oWnd
STATIC OBTNB_MOD, OBTNB_TOP, OBTNB_PREV, OBTNB_NEXT, OBTNB_BOTT, OBTNB_EXIT
STATIC LOBTNB_MOD := .T., LOBTNB_TOP := .T., LOBTNB_PREV := .T., ;
LOBTNB_NEXT := .T., LOBTNB_BOTT := .T., LOBTNB_EXIT := .T.
FUNCTION Main()
LOCAL oBar, oIco, oBmp
SkinButtons()
DEFINE ICON oIco FILE "..\icons\fax.ico"
DEFINE WINDOW oWnd FROM 1, 1 TO 22, 75 TITLE "FiveWin The Best" ;
COLOR "B/W" ICON oIco
DEFINE BUTTONBAR oBar BUTTONSIZE 40, 40 _3DLOOK TOP OF oWnd 2015 // 2007
oBar:nClrText := CLR_HBLUE
oBar:Adjust()
DEFINE BUTTON oBtnB_Mod RESOURCE "open" OF oBar NOBORDER GROUP ;
TOOLTIP "Amend" PROMPT "A" ;
ACTION toggle( .F. ) WHEN( LOBTNB_MOD )
DEFINE BUTTON oBtnB_Top RESOURCE "CLOSE" OF oBar NOBORDER GROUP ;
TOOLTIP "Top" WHEN( LOBTNB_TOP ) PROMPT "B"
DEFINE BUTTON oBtnB_Prev RESOURCE "CUT" OF oBar NOBORDER GROUP ;
TOOLTIP "Previous" WHEN( LOBTNB_PREV ) PROMPT "C"
DEFINE BUTTON oBtnB_Next RESOURCE "COPY" OF oBar NOBORDER GROUP ;
TOOLTIP "Next" WHEN( LOBTNB_NEXT ) PROMPT "D"
DEFINE BUTTON oBtnB_Bott RESOURCE "PASTE" OF oBar NOBORDER GROUP ;
TOOLTIP "Bottom" WHEN( LOBTNB_BOTT ) PROMPT "E"
DEFINE BUTTON oBtnB_Exit RESOURCE "EXIT" OF oBar NOBORDER GROUP ;
TOOLTIP "Abort/Exit" PROMPT "Exit" ;
ACTION toggle( .T. ) WHEN( LOBTNB_EXIT )
DEFINE BITMAP oBmp FILENAME "..\bitmaps\visual.bmp"
oWnd:bPainted = { | hDC | BmpTiled( hDC, oWnd, oBmp ) }
ACTIVATE WINDOW oWnd CENTERED
LOBTNB_MOD := .T.
LOBTNB_TOP := .T.
LOBTNB_PREV := .T.
LOBTNB_NEXT := .T.
LOBTNB_BOTT := .T.
LOBTNB_EXIT := .T.
RETURN NIL
FUNCTION Toggle( lEnable ) // Alternar
IF lEnable
LOBTNB_MOD := .T.
LOBTNB_MOD := .T.
LOBTNB_TOP := .T.
LOBTNB_PREV := .T.
LOBTNB_NEXT := .T.
LOBTNB_BOTT := .T.
LOBTNB_EXIT := .T.
oBtnB_Mod:Refresh()
oBtnB_Top:Refresh()
oBtnB_Prev:Refresh()
oBtnB_Next:Refresh()
oBtnB_Bott:Refresh()
ELSE
LOBTNB_MOD := .F.
LOBTNB_MOD := .F.
LOBTNB_TOP := .F.
LOBTNB_PREV := .F.
LOBTNB_NEXT := .F.
LOBTNB_BOTT := .F.
LOBTNB_EXIT := .T.
oBtnB_Mod:Refresh()
oBtnB_Top:Refresh()
oBtnB_Prev:Refresh()
oBtnB_Next:Refresh()
oBtnB_Bott:Refresh()
ENDIF
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
/*
// TESTBAR4.RC
open BITMAP "../bitmaps/open.bmp"
close BITMAP "../bitmaps/close.bmp"
exit BITMAP "../bitmaps/exit.bmp"
cut BITMAP "../bitmaps/cut.bmp"
copy BITMAP "../bitmaps/copy.bmp"
paste BITMAP "../bitmaps/paste.bmp"
about BITMAP "../bitmaps/about.bmp"
help BITMAP "../bitmaps/info.bmp"
thishelp BITMAP "../bitmaps/help.bmp"
*/
// fin / end
// TESTBAR4.RC
open BITMAP "../bitmaps/open.bmp"
close BITMAP "../bitmaps/close.bmp"
exit BITMAP "../bitmaps/exit.bmp"
cut BITMAP "../bitmaps/cut.bmp"
copy BITMAP "../bitmaps/copy.bmp"
paste BITMAP "../bitmaps/paste.bmp"
about BITMAP "../bitmaps/about.bmp"
help BITMAP "../bitmaps/info.bmp"
thishelp BITMAP "../bitmaps/help.bmp"
// fin / end
// This sample shows how to create a Management Menu whit ButtonBar and Menu.
#include "FiveWin.ch"
static oWnd
static lEnable := .t.
//----------------------------------------------------------------------------//
function Main()
local oBrush, oBar
DEFINE BRUSH oBrush STYLE TILED
DEFINE WINDOW oWnd FROM 1, 5 TO 20, 75 ;
TITLE "BUTTONBAR oBar SIZE 33,33 GDIP OF oWnd" ;
BRUSH oBrush ;
MENU BuildMenu()
DEFINE BUTTONBAR oBar SIZE 33,33 GDIP OF oWnd
DEFINE BUTTON OF oBar FILE "..\bitmaps\olga1.jpg(32x32)" MESSAGE "Create a new project" ;
ACTION MsgInfo( "New Project", "Information" ) WHEN lEnable
DEFINE BUTTON OF oBar FILE "..\bitmaps\OpenPrj.bmp" MESSAGE "Open a previous project" ;
ACTION MsgStop( "Open Project", "Stop" ) WHEN lEnable
DEFINE BUTTON OF oBar FILE "..\bitmaps\SavePrj.bmp" MESSAGE "Save this project" ;
ACTION MsgAlert( "Save this project", "Hey!" ) WHEN lEnable
DEFINE BUTTON OF oBar FILE "..\bitmaps\Exit.bmp" MESSAGE "End this session" ;
ACTION If( MsgYesNo( "Do you want to end ?", "Please Select" ),;
oWnd:End(), ) WHEN lEnable
DEFINE BUTTON OF oBar FILE "..\bitmaps\Cut.bmp" MESSAGE "Cut to ClipBoard" GROUP ;
ACTION MsgInfo( "You can easily call your functions from the ButtonBar",;
"Well, this is FiveWin" ) WHEN lEnable
DEFINE BUTTON OF oBar FILE "..\bitmaps\Copy.bmp" MESSAGE "Copy to ClipBoard" ;
ACTION MsgStop( "FiveWin automatically will execute your actions",;
"Go for productivity!" ) WHEN lEnable
DEFINE BUTTON OF oBar FILE "..\bitmaps\top.bmp" MESSAGE "Go Top" ;
ACTION MsgInfo( "Go Top" ) GROUP WHEN lEnable
DEFINE BUTTON OF oBar FILE "..\bitmaps\prev.bmp" MESSAGE "previous" ;
ACTION MsgInfo( "Go Up" ) WHEN lEnable
DEFINE BUTTON OF oBar FILE "..\bitmaps\next.bmp" MESSAGE "Skip Next" ;
ACTION MsgInfo( "Skip Next" ) WHEN lEnable
DEFINE BUTTON OF oBar FILE "..\bitmaps\bottom.bmp" MESSAGE "Go Bottom" ;
ACTION MsgInfo( "Go Bottom" ) WHEN lEnable
DEFINE BUTTON OF oBar FILE "..\bitmaps\Calendar.bmp" MESSAGE "Calling Windows Calendar" ;
ACTION WinExec( "Calendar" ) GROUP WHEN lEnable
DEFINE BUTTON OF oBar FILE "..\bitmaps\ClipBoar.bmp" MESSAGE "Looking at ClipBoard" ;
ACTION WinExec( "Clipbrd" ) WHEN lEnable
DEFINE BUTTON OF oBar FILE "..\bitmaps\Help.bmp" MESSAGE "Windows Help" ;
ACTION WinHelp( "progman.hlp" ) WHEN lEnable
SET MESSAGE OF oWnd TO FWVERSION + "-" + FWCOPYRIGHT CENTERED
oWnd:bRClicked := { || lEnable := !lEnable, oBar:AEvalWhen(), oBar:Refresh() }
ACTIVATE WINDOW oWnd CENTERED
return nil
//----------------------------------------------------------------------------//
function BuildMenu()
local oMenu
MENU oMenu
MENUITEM "&Information"
MENU
MENUITEM "About..." MESSAGE "About FiveWin" ;
ACTION MsgAbout( FWVERSION, FWCOPYRIGHT )
SEPARATOR
MENUITEM FILE "..\bitmaps\End.bmp" MESSAGE "End this session" ;
ACTION If( MsgYesNo( "Do you want to end ?", "Please select" ),;
oWnd:End(), )
ENDMENU
MENUITEM "&Files"
MENU
MENUITEM "&Clients"
MENU
MENUITEM "&New..." MESSAGE "Add a new Client" ;
ACTION MsgInfo( "New Client", "Call here your functions..." )
MENUITEM "&Modify..." MESSAGE "Modify the information"
MENUITEM "what ever..." MESSAGE "FiveWin is so easy!"
ENDMENU
MENUITEM "&Stocks"
ENDMENU
MENUITEM "&Utilities"
MENU
MENUITEM FILE "..\bitmaps\Calc.bmp" MESSAGE "Calling calculator" ;
ACTION WinExec( "Calc" )
MENUITEM FILE "..\bitmaps\FiveWin.bmp" ;
ACTION MsgInfo( FWVERSION,;
"The xBase & Windows revolution!" )
ENDMENU
ENDMENU
return oMenu
//----------------------------------------------------------------------------//
procedure AppSys // XBase++ requirement
return
//----------------------------------------------------------------------------//
#include "FiveWin.ch"
static oWnd, oBar
static lEnable := .t.
//----------------------------------------------------------------------------//
function Main()
local oBtn
DEFINE WINDOW oWnd
// define buttonbar oBar of oWnd size 30,33 2015 3DLOOK
// OR
define buttonbar oBar of oWnd size 30,33 GDIP 2015
DEFINE BUTTON oBtn RESOURCE "B_EDIT" OF oBar ;
TOOLTIP "Amend" ;
DEFINE BUTTON oBtn RESOURCE "B_TOP" OF oBar GROUP ;
TOOLTIP "Top" ;
DEFINE BUTTON oBtn RESOURCE "B_PREV" OF oBar ;
TOOLTIP "Previous" ;
DEFINE BUTTON oBtn RESOURCE "B_NEXT" OF oBar ;
TOOLTIP "Next" ;
DEFINE BUTTON oBtn RESOURCE "B_BOTT" OF oBar ;
TOOLTIP "Bottom"
DEFINE BUTTON oBtn RESOURCE "B_EXIT" OF oBar GROUP ;
TOOLTIP "Abort/Exit" ;
AEval( oBar:aControls, { |o| o:bWhen := { || lEnable } } )
oWnd:bRClicked := { || lEnable := !lEnable, oBar:AEvalWhen(), oBar:Refresh() }
ACTIVATE WINDOW oWnd CENTERED
return nil
//----------------------------------------------------------------------------//
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 43 guests