Disabled buttons at oBar not greyed out after using FWH1912
Disabled buttons at oBar not greyed out after using FWH1912
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
After I link with newer HB+FWH1912 the disabled buttons are not greyed out anymore.
Any tip on what should I be checking?
TIA
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
BCC5.82/BCC7.3
xHarbour/Harbour
Re: Disabled buttons at oBar not greyed out after using FWH1912
Tried amending FWH1912\SAMPLES\testbar.prg also showed diabled button not greyed out
Code: Select all | Expand
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()
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
BCC5.82/BCC7.3
xHarbour/Harbour
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Disabled buttons at oBar not greyed out after using FWH1912
We'll check
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Disabled buttons at oBar not greyed out after using FWH1912
Properly greyed out if use DEFINE BUTTONBAR GDIP clause but buttons' images are not sharp
With clause 2015
With clause 2015
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
BCC5.82/BCC7.3
xHarbour/Harbour
Re: Disabled buttons at oBar not greyed out after using FWH1912
oBtn is LOCAL or STATIC?
Regards, saludos.
Code: Select all | Expand
ACTIVATE WINDOW oWnd ON INIT( oBtn:disable(), oBtn:Refresh() )
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Re: Disabled buttons at oBar not greyed out after using FWH1912
LOCALkarinha wrote:oBtn is LOCAL or STATIC?
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
BCC5.82/BCC7.3
xHarbour/Harbour
Re: Disabled buttons at oBar not greyed out after using FWH1912
Some observations after test:
1. DEFINE BUTTON OF oBar ... WHEN .F. will also show image not greyed out even though it's not clickable
2. Will show grey out button during disabled state if the grey button image is provided
But this is a lot of work, testing, checking, ensuring all buttons in all modules are shown properly unless I'm willing to use GDIPLUS clause which results in non-sharp images of buttons.
Question; cResName2, cResName3 and cResName4 are for what states? Is it Normal, Pressed, Inactive and Mouse Over?
1. DEFINE BUTTON OF oBar ... WHEN .F. will also show image not greyed out even though it's not clickable
2. Will show grey out button during disabled state if the grey button image is provided
Code: Select all | Expand
DEFINE BUTTON oBtnB_Top RESOURCE "B_TOP","B_TOP","B_GREY","B_TOP" OF oBar GROUP
Question; cResName2, cResName3 and cResName4 are for what states? Is it Normal, Pressed, Inactive and Mouse Over?
Code: Select all | Expand
#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> ];
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
BCC5.82/BCC7.3
xHarbour/Harbour
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Disabled buttons at oBar not greyed out after using FWH1912
YesIs it Normal, Pressed, Inactive and Mouse Over?
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Disabled buttons at oBar not greyed out after using FWH1912
Thanks for pointing out.
Will you please make the following 2 changes in the "btnbmp.prg" and test?
First change:
In the btnbmp.prg, please go to the METHOD PaintBitmap()
Please locate these lines:
1547 to 1590 in version 1911
Insert these 3 lines above those lines:
Now, after the change, it should look like this:
Second Change:
Please locate these lines towards the end of the same method:
Please replace these lines with this revised code:
After making these two changes, I request you to please test with all variations and let us have your feedback.
Thanks again.
Will you please make the following 2 changes in the "btnbmp.prg" and test?
First change:
In the btnbmp.prg, please go to the METHOD PaintBitmap()
Please locate these lines:
1547 to 1590 in version 1911
Code: Select all | Expand
lPalBtnPaint := .t.
return nil
endif
//
Code: Select all | Expand
if lGray
BtnDisable( ::hWnd, ::hDC )
endif
Code: Select all | Expand
if lGray
BtnDisable( ::hWnd, ::hDC )
endif
lPalBtnPaint := .t.
return nil
endif
//
Please locate these lines towards the end of the same method:
Code: Select all | Expand
::DrawImage( ::aImages[ ::nBmpNo ], aBmpRect, ::lBmpTransparent, uResize, ;
If( ::lAlpha, ::nAlphaLevel, .f. ), lGray, nil, aColorMap )
Code: Select all | Expand
::DrawImage( ::aImages[ ::nBmpNo ], aBmpRect, ::lBmpTransparent, uResize, ;
If( lGray, 100, If( ::lAlpha, ::nAlphaLevel, .f. ) ), ;
lGray, nil, aColorMap )
Thanks again.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Disabled buttons at oBar not greyed out after using FWH1912
This is the result Rao:
SAMPLES\testbar.prg now shows disabled state
But for my module which supply only 1 image for a button, it still behave the same, some buttons are greyed out some are not.
I created a self-contained program so you can test it. The .rc was created using Borland Resource Workshop
https://drive.google.com/file/d/1kNGMOV ... sp=sharing
TIA
SAMPLES\testbar.prg now shows disabled state
But for my module which supply only 1 image for a button, it still behave the same, some buttons are greyed out some are not.
I created a self-contained program so you can test it. The .rc was created using Borland Resource Workshop
https://drive.google.com/file/d/1kNGMOV ... sp=sharing
TIA
Last edited by hua on Fri Sep 15, 2023 3:17 am, edited 1 time in total.
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
BCC5.82/BCC7.3
xHarbour/Harbour
Re: Disabled buttons at oBar not greyed out after using FWH1912
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Re: Disabled buttons at oBar not greyed out after using FWH1912
Code: Select all | Expand
// 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
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Re: Disabled buttons at oBar not greyed out after using FWH1912
Code: Select all | Expand
// 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
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Disabled buttons at oBar not greyed out after using FWH1912
testbar.prg with minor modifications:
Code: Select all | Expand
// 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
//----------------------------------------------------------------------------//
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Disabled buttons at oBar not greyed out after using FWH1912
Your testbar.prg slightly modified:
Code: Select all | Expand
#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
//----------------------------------------------------------------------------//
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India