Disabled buttons at oBar not greyed out after using FWH1912

Disabled buttons at oBar not greyed out after using FWH1912

Postby hua » Mon Sep 11, 2023 4:52 am

Using my old FWH, (xHb+FWH1411), disabled buttons at oBar is greyed out as expected.
Image

After I link with newer HB+FWH1912 the disabled buttons are not greyed out anymore.
Image

Any tip on what should I be checking?

TIA
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Disabled buttons at oBar not greyed out after using FWH1912

Postby hua » Mon Sep 11, 2023 6:50 am

Tried amending FWH1912\SAMPLES\testbar.prg also showed diabled button not greyed out
Code: Select all  Expand view  RUN

   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
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Disabled buttons at oBar not greyed out after using FWH1912

Postby nageswaragunupudi » Mon Sep 11, 2023 10:29 am

We'll check
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Disabled buttons at oBar not greyed out after using FWH1912

Postby hua » Mon Sep 11, 2023 10:31 am

Properly greyed out if use DEFINE BUTTONBAR GDIP clause but buttons' images are not sharp

Image

With clause 2015
Image
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Disabled buttons at oBar not greyed out after using FWH1912

Postby karinha » Mon Sep 11, 2023 12:23 pm

oBtn is LOCAL or STATIC?

Code: Select all  Expand view  RUN

   ACTIVATE WINDOW oWnd ON INIT( oBtn:disable(), oBtn:Refresh() )
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7831
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Disabled buttons at oBar not greyed out after using FWH1912

Postby hua » Tue Sep 12, 2023 2:11 am

karinha wrote:oBtn is LOCAL or STATIC?


LOCAL
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Disabled buttons at oBar not greyed out after using FWH1912

Postby hua » Wed Sep 13, 2023 8:46 am

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
Code: Select all  Expand view  RUN

     DEFINE BUTTON oBtnB_Top RESOURCE "B_TOP","B_TOP","B_GREY","B_TOP" OF oBar GROUP
 

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?
Code: Select all  Expand view  RUN
#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
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Disabled buttons at oBar not greyed out after using FWH1912

Postby nageswaragunupudi » Wed Sep 13, 2023 11:27 am

Is it Normal, Pressed, Inactive and Mouse Over?

Yes
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Disabled buttons at oBar not greyed out after using FWH1912

Postby nageswaragunupudi » Wed Sep 13, 2023 6:56 pm

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

Code: Select all  Expand view  RUN
     lPalBtnPaint   := .t.
      return nil
   endif
   //
 


Insert these 3 lines above those lines:
Code: Select all  Expand view  RUN
     if lGray
         BtnDisable( ::hWnd, ::hDC )
      endif
 


Now, after the change, it should look like this:
Code: Select all  Expand view  RUN
     if lGray
         BtnDisable( ::hWnd, ::hDC )
      endif

      lPalBtnPaint   := .t.
      return nil
   endif
   //
 


Second Change:
Please locate these lines towards the end of the same method:
Code: Select all  Expand view  RUN
  ::DrawImage( ::aImages[ ::nBmpNo ], aBmpRect, ::lBmpTransparent, uResize, ;
      If( ::lAlpha, ::nAlphaLevel, .f. ), lGray, nil, aColorMap )
 


Please replace these lines with this revised code:
Code: Select all  Expand view  RUN
  ::DrawImage( ::aImages[ ::nBmpNo ], aBmpRect, ::lBmpTransparent, uResize, ;
      If( lGray, 100, If( ::lAlpha, ::nAlphaLevel, .f. ) ), ;
      lGray, nil, aColorMap )
 


After making these two changes, I request you to please test with all variations and let us have your feedback.
Thanks again.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Disabled buttons at oBar not greyed out after using FWH1912

Postby hua » Thu Sep 14, 2023 8:05 am

This is the result Rao:

SAMPLES\testbar.prg now shows disabled state
Image

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
Image

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
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Disabled buttons at oBar not greyed out after using FWH1912

Postby karinha » Thu Sep 14, 2023 3:04 pm

https://imgur.com/oreN6GY

Image

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7831
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Disabled buttons at oBar not greyed out after using FWH1912

Postby karinha » Thu Sep 14, 2023 3:24 pm

Code: Select all  Expand view  RUN

// 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
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7831
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Disabled buttons at oBar not greyed out after using FWH1912

Postby karinha » Thu Sep 14, 2023 3:31 pm

Code: Select all  Expand view  RUN

// 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
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7831
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Disabled buttons at oBar not greyed out after using FWH1912

Postby nageswaragunupudi » Thu Sep 14, 2023 6:12 pm

testbar.prg with minor modifications:

Image

Image

Image

Code: Select all  Expand view  RUN
// 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

//----------------------------------------------------------------------------//


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Disabled buttons at oBar not greyed out after using FWH1912

Postby nageswaragunupudi » Thu Sep 14, 2023 6:53 pm

Your testbar.prg slightly modified:
Code: Select all  Expand view  RUN
#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

//----------------------------------------------------------------------------//


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 77 guests