Page 1 of 1

CLASSE DSAY.PRG CON COMANDO TRANSPARENT

Posted: Sat Feb 18, 2006 1:32 pm
by karinha
Buenas...

Hola Foro. Necesito di una DSAY.PRG y DSAY.CH modificada para el uso del comando TRANSPARENT.

És posible??

kmt_karinha@pop.com.br

Gracias, Saludos a todos.

Posted: Mon Feb 20, 2006 9:58 am
by Antonio Linares
João,

Code: Select all

METHOD Paint() CLASS TDSay

   local n 
   local nColorShadow, nColorLight

   ::GetDC()

   if ::lActive

      if ::lView
         if ::lTransparent .and. ! Empty( ::oBrush:hBitmap )
            SetBrushOrgEx( ::hDC, nBmpWidth( ::oBrush:hBitmap ) - ::nLeft, nBmpHeight( ::oBrush:hBitmap ) - ::nTop )
            FillRect( ::hDC, GetClientRect( ::hWnd ), ::oBrush:hBrush )
         endif 
         
         for n := 1 to len( ::aCaption )
            ...
Also this fix is required in control.prg:

Code: Select all

METHOD Initiate( hDlg ) CLASS TControl

   ...

   if ::lTransparent
      ::SetBrush( ::oWnd:oBrush ) 
   else
      ::SetBrush( TBrush():New( "NULL" ) )
   endif   

return nil

Posted: Mon Feb 20, 2006 11:38 am
by Baxajaun
Antonio,

thanks a lot !!! :wink:

Saludos,

Félix

Posted: Tue Feb 21, 2006 2:47 pm
by karinha
Antonio, No Funciono... Ke hice errado??

Aplicacao:
===========
Caminho(Path): C:\PDVXB\BALCAOW.EXE (32 bits)
Tamanho: 3,496,960 bytes
Hora Inicial: 0 hours 0 mins 1 secs
Ocorrencia de Erro: 21/02/06, 11:43:58
Descricao do Erro: Error BASE/1004 Message not found: TDSAY:LTRANSPARENT

Chamada da Pilha:
=================
Chamada De: TDSAY:ERROR(179)
Chamada De: (b)HBOBJECT:HBOBJECT(105)
Chamada De: TDSAY:MSGNOTFOUND(0)
Chamada De: TDSAY:LTRANSPARENT(167)
Chamada De: TCONTROL:INITIATE(378)
Chamada De: (b)TDSAY:TDSAY(68)
Chamada De: TDSAY:INITIATE(0)
Chamada De: __OBJSENDMSG(0)
Chamada De: OSEND(224)
Chamada De: ASEND(175)
Chamada De: TDIALOG:INITIATE(638)
Chamada De: TDIALOG:HANDLEEVENT(855)
Chamada De: DIALOGBOXINDIRECT(0)
Chamada De: TDIALOG:ACTIVATE(264)
Chamada De: SENHA2(335)
Chamada De: SENHA(137)
Chamada De: MAIN(295)

Posted: Tue Feb 21, 2006 2:50 pm
by karinha
//-> CLASSE DSAY.PRG

METHOD Paint() CLASS TDSay

local n
local nColorShadow, nColorLight

::GetDC()

if ::lActive

if ::lView

//-> Modificado Por Antonio Linares, em 20/02/2006 Para TRANSPARENT
if ::lTransparent .and. ! Empty( ::oBrush:hBitmap )
SetBrushOrgEx( ::hDC, nBmpWidth( ::oBrush:hBitmap ) - ::nLeft, nBmpHeight( ::oBrush:hBitmap ) - ::nTop )
FillRect( ::hDC, GetClientRect( ::hWnd ), ::oBrush:hBrush )
endif

for n := 1 to len( ::aCaption )
WSay( ::hWnd, ::hDC, ::nDTop + ( n - 1 ) * ::nTxtHeight, ::nDLeft, ::aCaption[ n ], ::nClrText,,;
If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
next

if ::lScroll .and. ::lWrap
if ::lHorizontal
for n := 1 to len( ::aCaption )
WSay( ::hWnd, ::hDC, ::nDTop + ( n - 1 ) * ::nTxtHeight, ::nDLeft + ::nLong, ::aCaption[ n ], ::nClrText,,;
If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
next
else
for n := 1 to len( ::aCaption )
WSay( ::hWnd, ::hDC, ::nDTop + ( n - 1 ) * ::nTxtHeight + ::nLong, ::nDLeft, ::aCaption[ n ], ::nClrText,,;
If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
next
endif
endif

else

InvalidateRect( ::hWnd, ::aRect, .t. )

endif

else

nColorShadow := GetSysColor( COLOR_BTNSHADOW )
nColorLight := GetSysColor( COLOR_BTNHIGHLIGHT )

for n := 1 to len( ::aCaption )
WSay( ::hWnd, ::hDC, ::nDTop + ( n - 1 ) * ::nTxtHeight + 1, ::nDLeft + 1, ::aCaption[ n ], nColorLight,,;
If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
WSay( ::hWnd, ::hDC, ::nDTop + ( n - 1 ) * ::nTxtHeight, ::nDLeft, ::aCaption[ n ], nColorShadow,,;
If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
next

endif

// 3D

if ::lShaded
WndInset( ::hWnd, ::hDC ) // SHADED, SHADOW
endif

if ::lRaised
WndRaised( ::hWnd, ::hDC ) // RAISED
endif

if ::lBox
WndBoxIn( ::hDC, 0, 0, ::nBottom-::nTop, ::nRight-::nLeft )
WndBoxRaised( ::hDC, 1, 1, ::nBottom-::nTop-1, ::nRight-::nLeft-1 )
endif

::ReleaseDC()

return nil

Posted: Tue Feb 21, 2006 2:54 pm
by karinha
CLASSE CONTROL.PRG

METHOD Initiate( hDlg ) CLASS TControl

DEFAULT ::lActive := .t., ::lDrag := .f., ::lCaptured := .f.,;
::lFocused := .f., ::lCancel := .f.

if( ( ::hWnd := GetDlgItem( hDlg, ::nId ) ) != 0 )

If( ::lActive, ::Enable(), ::Disable() )
::Link()

if ::oFont != nil
::SetFont( ::oFont )
else
::GetFont()
endif

else
#define NOVALID_CONTROLID 1
Eval( ErrorBlock(), _FWGenError( NOVALID_CONTROLID, "No: " + ;
Str( ::nId, 6 ) ) )
endif

//->Modificado Por Antonio Linares, em 20/02/2006 Para TRANSPARENT em DSAY.PRG
if ::lTransparent
::SetBrush( ::oWnd:oBrush )
else
::SetBrush( TBrush():New( "NULL" ) )
endif

return nil