Page 1 of 1

Disabled BtnBmp 11.08

PostPosted: Mon Sep 12, 2011 3:34 pm
by PeterHarmes
Hi,

I'm curently testing FW 11.08 and after modifying my BMP my BTNBMPs look ok now. However, if the button is disabled (the when returns false), a solid grey box appears instead of a greyed out version of the bitmap.

This worked ok in 10.06 and now when recompiled with 11.08, I have this problem.

Apart from this 11.08 looks good :)

Any ideas?

Regards,

Pete

Re: Disabled BtnBmp 11.08

PostPosted: Wed Sep 21, 2011 1:52 pm
by PeterHarmes
Anyone have any ideas?

Re: Disabled BtnBmp 11.08

PostPosted: Wed Sep 21, 2011 2:10 pm
by PeterHarmes
Uwe,

I'm using the one you emailed to me on the 14th September :wink:

Best regards,

Pete

Re: Disabled BtnBmp 11.08

PostPosted: Wed Sep 21, 2011 2:56 pm
by PeterHarmes
I have compared the btnbmp source between 11.08 & 10.06 and thankfully there wasnt many changes - I have found the cause of my problem:

Line 1281 in 11.08 is

Code: Select all  Expand view


  IF !Empty( hBmp )
     if SetAlpha() .and. ::aAlpha[ nBtn ]
        ABPaint( ::hDC, if( ::lAdjust, nAdjust, nBmpLeft+nAdjust), if( ::lAdjust, nAdjust, nBmpTop+nAdjust ), hBmp, ::nAlphaLevel() )
     elseif IsAppThemed()
        if !::lTransparent
           PalBtnPaint( ::hWnd, if( ::lMOver .and. !Empty( ::hBitmap4 ), ::hBitmap4, ::hBitmap1 ),;
                  if( ::lMOver .and. !Empty( ::hBitmap4 ), ::hPalette4, ::hPalette1 ),;
                  if ( ::lAdjust .and. empty( ::hBitmap2 ), ::hBitmap1,::hBitmap2 ),;
                  if ( ::lAdjust .and. empty( ::hBitmap2 ), ::hPalette1,::hPalette2),;
                  ::hBitmap3, ::hPalette3, ::lPressed, ::lAdjust, ::lBorder,;
                  ::oPopup != nil,;
                  ::nClrPane, if ( ::cCaption == "...", ::cCaption,) , ::nLayout,;
                  If( ::oFont != nil, ::oFont:hFont, 0 ),;
                  If( ValType( ::nClrText ) == "B", Eval( ::nClrText, ::lMOver ), ::nClrText ), ::hDC,;
                  Upper( ::oWnd:ClassName() ) != "TBAR" )
         else
            hBmpOld = SelectObject( ::hDC, hBmp )
            nZeroZeroClr = GetPixel( ::hDC, 0, 0 )
            SelectObject( ::hDC, hBmpOld )
            nOldClr = SetBkColor( ::hDC, nRGB( 255, 255, 255 ) )
            TransBmp( hBmp, nBmpWidth, nBmpHeight, nZeroZeroClr, ::hDC,;
                         if( ::lAdjust, nAdjust, nBmpLeft + nAdjust ), ;
                         if( ::lAdjust, nAdjust, nBmpTop + nAdjust ),;
                         if (::lAdjust, ::nWidth, nBmpWidth ) ,;
                         if( ::lAdjust, ::nHeight, nBmpHeight ) )
            SetBkColor( ::hDC, nOldClr )
         endif
      else
        hBmpOld = SelectObject( ::hDC, hBmp )
        nZeroZeroClr = GetPixel( ::hDC, 0, 0 )
        SelectObject( ::hDC, hBmpOld )
        nOldClr = SetBkColor( ::hDC, nRGB( 255, 255, 255 ) )
        TransBmp( hBmp, nBmpWidth, nBmpHeight, nZeroZeroClr, ::hDC,;
                     if( ::lAdjust, nAdjust, nBmpLeft + nAdjust ), ;
                     if( ::lAdjust, nAdjust, nBmpTop + nAdjust ),;
                     if (::lAdjust, ::nWidth, nBmpWidth ) ,;
                     if( ::lAdjust, ::nHeight, nBmpHeight ) )
        SetBkColor( ::hDC, nOldClr )
    endif

  else

 


Line 1273 in 10.06

Code: Select all  Expand view

  IF !Empty( hBmp )
     if SetAlpha() .and. ::aAlpha[ nBtn ]
        ABPaint( ::hDC, if( ::lAdjust, nAdjust, nBmpLeft+nAdjust), if( ::lAdjust, nAdjust, nBmpTop+nAdjust ), hBmp, ::nAlphaLevel() )
     elseif IsAppThemed() .or. !::lTransparent
        PalBtnPaint( ::hWnd, if( ::lMOver .and. !Empty( ::hBitmap4 ), ::hBitmap4, ::hBitmap1 ),;
                  if( ::lMOver .and. !Empty( ::hBitmap4 ), ::hPalette4, ::hPalette1 ),;
                  if ( ::lAdjust .and. empty( ::hBitmap2 ), ::hBitmap1,::hBitmap2 ),;
                  if ( ::lAdjust .and. empty( ::hBitmap2 ), ::hPalette1,::hPalette2),;
                  ::hBitmap3, ::hPalette3, ::lPressed, ::lAdjust, ::lBorder,;
                  ::oPopup != nil,;
                  ::nClrPane, if ( ::cCaption == "...", ::cCaption,) , ::nLayout,;
                  If( ::oFont != nil, ::oFont:hFont, 0 ),;
                  If( ValType( ::nClrText ) == "B", Eval( ::nClrText, ::lMOver ), ::nClrText ), ::hDC,;
                  Upper( ::oWnd:ClassName() ) != "TBAR" )
      else
        hBmpOld = SelectObject( ::hDC, hBmp )
        nZeroZeroClr = GetPixel( ::hDC, 0, 0 )
        SelectObject( ::hDC, hBmpOld )
        nOldClr = SetBkColor( ::hDC, nRGB( 255, 255, 255 ) )
        TransBmp( hBmp, nBmpWidth, nBmpHeight, nZeroZeroClr, ::hDC,;
                     if( ::lAdjust, nAdjust, nBmpLeft + nAdjust ), ;
                     if( ::lAdjust, nAdjust, nBmpTop + nAdjust ),;
                     if (::lAdjust, ::nWidth, nBmpWidth ) ,;
                     if( ::lAdjust, ::nHeight, nBmpHeight ) )
        SetBkColor( ::hDC, nOldClr )
    endif
 


If I change the following in 11.08 all works ok:

Code: Select all  Expand view

  IF !Empty( hBmp )
     if SetAlpha() .and. ::aAlpha[ nBtn ]
        ABPaint( ::hDC, if( ::lAdjust, nAdjust, nBmpLeft+nAdjust), if( ::lAdjust, nAdjust, nBmpTop+nAdjust ), hBmp, ::nAlphaLevel() )
     elseif IsAppThemed() .or. !::lTransparent
        if !::lTransparent
 


Is there a reason for this and could this be put back in future releases?

Regards,

Pete

Re: Disabled BtnBmp 11.08

PostPosted: Wed Sep 21, 2011 4:23 pm
by ukoenig
Pete,

maybe also possible, to define or keep the Textcolor of a disabled Button ?
( added a Test to my new Tool )
A grey Button is defined for disabled.
From the Explorerbar I disable the Button.
The grey Button is displayed, but the Text is not visible anymore.

Image

Code: Select all  Expand view

FUNCTION SHOW_BTN()

@ 200, 200 BTNBMP oBtnA OF oWndMain ;
SIZE 120, 82 PIXEL ;
NOBORDER ;
ADJUST ;
PROMPT "" + CRLF + "" + CRLF + "Save and &Exit" ;
FILENAME c_path + "\Images\BtnShow.Bmp", ;
   c_path + "\Images\BtnFocus.Bmp", ;
   c_path + "\Images\BtnDisable.Bmp", ;
   c_path + "\Images\BtnClick.Bmp" ;
ACTION ( SAVE_INI(), oWndMain:End() ) ;
FONT oFont[1] ;
CENTER
oBtnA:lTransparent := .f.
oBtnA:cToolTip = { "Save to INI" + CRLF + "and Exit","Exit", 1, CLR_BLACK, 14089979 }
oBtnA:SetColor( 0, ) // Startup

RETURN( NIL )
 


Best Regards
Uwe :?:

Re: Disabled BtnBmp 11.08

PostPosted: Thu Sep 22, 2011 10:09 am
by PeterHarmes
I dont use text/captions on my btnbmp - I did try defining a "greyed out" bitmap but it still showed as a grey square

Pete

Re: Disabled BtnBmp 11.08

PostPosted: Fri Sep 23, 2011 4:31 am
by Antonio Linares
Pete,

Please email me your entire modified btnbmp.prg file, thanks :-)