Disabled BtnBmp 11.08

Disabled BtnBmp 11.08

Postby PeterHarmes » Mon Sep 12, 2011 3:34 pm

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
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: Disabled BtnBmp 11.08

Postby PeterHarmes » Wed Sep 21, 2011 1:52 pm

Anyone have any ideas?
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: Disabled BtnBmp 11.08

Postby PeterHarmes » Wed Sep 21, 2011 2:10 pm

Uwe,

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

Best regards,

Pete
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: Disabled BtnBmp 11.08

Postby PeterHarmes » Wed Sep 21, 2011 2:56 pm

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
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: Disabled BtnBmp 11.08

Postby ukoenig » Wed Sep 21, 2011 4:23 pm

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 :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Disabled BtnBmp 11.08

Postby PeterHarmes » Thu Sep 22, 2011 10:09 am

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
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: Disabled BtnBmp 11.08

Postby Antonio Linares » Fri Sep 23, 2011 4:31 am

Pete,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41454
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 113 guests

cron