To Antonio: Change for TSAY and GradientBrush()

To Antonio: Change for TSAY and GradientBrush()

Postby byte-one » Mon Mar 30, 2009 1:07 pm

Antonio, when using GradientBrush(), this change in code is required. If not, a new text with settext() are overwritten to the old text and both are visible!

Code: Select all  Expand view
METHOD SetText( cText ) CLASS TSay

   local hDC, nWidth , lBrush

   DEFAULT ::lTransparent := .f.

lBrush := Empty( ::oWnd:oBrush:hBitmap ) .or. ;
    (!empty(::oWnd:oBrush:hBitmap) .and. ( empty(::oWnd:oBrush:cBmpFile) .and. empty(::oWnd:oBrush:cBmpRes) ))  //for gradientbrush ; 2009 Günther Steiner

   ::cCaption := If( ::cPicture != nil, Transform( cText, ::cPicture ),;
                     cValToChar( cText ) )

   #ifndef __CLIPPER__
      if ! Empty( ::hWnd ) .and. ::oWnd:oBrush != nil  .and. lBrush .and. ( IsAppThemed() .or. ::lTransparent )
         DrawPBack( ::hWnd, hDC := GetDC( ::hWnd ) )
         ReleaseDC( ::hWnd, hDC )
      endif
   #endif

   if ! Empty( ::hWnd )
      if ! lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), nOr( SS_LEFT, SS_RIGHT, SS_CENTER ) ) .AND. ::lAdjust
         nWidth = GetTextWidth( 0, ::cCaption, If( ::oFont != nil, ::oFont:hFont,) ) + 20
         if nWidth > ::nWidth
            ::nWidth = nWidth
         endif
      endif
      SetWindowText( ::hWnd, ::cCaption )
   endif

return nil
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 89 guests