FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Pequeño problema con transparencias
Posts: 458
Joined: Tue Mar 14, 2006 07:26 PM
Pequeño problema con transparencias
Posted: Wed Oct 22, 2014 12:17 PM

Hola,

Me he encontrado que si tengo un objeto TSay Verde sobre negro en un TDialog normal, se ve correctamente.
Pero no pinta el fondo negro si defino que el diálogo es TRANSPARENT.

¿Cómo consigo poner un backColor a un TSay aunque el diálogo esté definido como TRANSPARENT?

Todo desde recursos, si el TSay está definido desde código, sí funciona correctamente.

Un Saludo,

Joaquín Martínez
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: Pequeño problema con transparencias
Posted: Wed Oct 22, 2014 01:00 PM

Porque no usas SSAY.PRG y SSAY.CH és mui mejor e puedes hacer 1000 cosas diferentes con SSAY.

Salu2.

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Pequeño problema con transparencias
Posted: Wed Oct 22, 2014 01:59 PM
Joaquín

You can define SetDlgGradient() at the top of your program and all your forms, says and gets will be transparent without you having to add the Transparent clause.

You can set your gradient colors to be any colors you like .. here are a couple of my samples :
Code (fw): Select all Collapse
//--------------
Func LightGreenGrad()

SetDlgGradient( { { .50, nRGB(210,235,216), nRGB( 255, 255, 255 ) } } )

Return(nil)

//------------------
Func LightBlueGrad()

SetDlgGradient( { { .50, nRGB( 201, 217, 237 ), nRGB( 231, 242, 255 ) } } )

Return(nil)

//------------------
Func LightGreyGrad()

SetDlgGradient( { { .50, nRGB( 216, 216, 216 ), nRGB( 255, 255, 255 ) } } )

Return(nil)

//-----------------
Func StandardGrad()

SetDlgGradient( { { .50, nRGB( 236, 233, 216 ), nRGB( 255, 255, 255 ) } } )

Return(nil)

//--------------------
Func DarkGreyGrad()

SetDlgGradient( { { 0.87, 16777215, 11513775 },{ 0.87,11513775, 16777215 }})
Return(nil)

//--------------------
Func SolidGrey()

SetDlgGradient( { { .50, nRGB( 233, 233, 233 ), nRGB( 233, 233, 233 ) } } )

Return(nil)

//--------------------
Func SolidChoral()

SetDlgGradient( { { .50, nRGB( 171, 129, 151 ), nRGB( 171, 129, 151 ) } } )  // choral


Return(nil)

//-----------------
Func LightYellow()

SetDlgGradient( { { 0.01,8440801,16777215 },{ 0.75,16777215,8440801 } })

Return(nil)

//-------------------
Func GreenBlueGrad()

SetDlgGradient( { { .50, nRGB( 192, 192, 192 ), nRGB( 45, 121, 147 ) } } )

Return(nil)
Posts: 458
Joined: Tue Mar 14, 2006 07:26 PM
Re: Pequeño problema con transparencias
Posted: Wed Oct 22, 2014 03:56 PM

Rick,

Thanks, but that is not the problem.

If dialog TRANSPARENT, TSay from resources, not display the background color.

Un Saludo,

Joaquín Martínez
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: Pequeño problema con transparencias
Posted: Wed Oct 22, 2014 05:17 PM
Code (fw): Select all Collapse
METHOD ReDefine( nId, bText, oWnd, cPicture,; 
                 nClrText, nClrBack, lUpdate, oFont, lTransparent, lAdjust ) CLASS TSay 

   DEFAULT oWnd      := GetWndDefault(),; 
           nClrText  := oWnd:nClrText,; 
           nClrBack  := GetSysColor( COLOR_BTNFACE ),; 
           lUpdate   := .f., lTransparent := .F., ; 
           lAdjust   := .f. 

   ::l3D          = .f. 
   ::nId          = nId 
   ::bGet         = bText 
   ::bSetGet      = bText 
   ::cPicture     = cPicture 
   ::oFont        = oFont 
   ::lTransparent = lTransparent 

   if bText != nil 
      ::cCaption = If( Empty( cPicture ), cValToChar( Eval( bText ) ),; 
                       Transform( Eval( bText ), cPicture ) ) 
   endif 

   ::oWnd      = oWnd 
   ::hWnd      = 0 
   ::lDrag     = .f. 
   ::lCaptured = .f. 
   ::lUpdate   = lUpdate 
   ::lWantClick = .f. 
   ::lAdjust   = lAdjust 

   //::SetColor( nClrText, nClrBack )

   // Cambia esto en SAY.PRG y prueba se funciona.
   ::SetColor( nClrText, if( lTransparent,, nClrBack ) )

   if oWnd != nil  // cambia aqui
      oWnd:DefControl( Self )
   endif

return Self


João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 498
Joined: Thu May 10, 2007 08:30 PM
Re: Pequeño problema con transparencias
Posted: Fri Oct 24, 2014 04:52 PM

jmartial,

parece que el problema está en que cuando defines un DIALOG como transparente, en su ::INITIATE() pone en .T. los ::lTransparent de todos sus controles. Por lo que veo, al menos en mi FWH, es, que lo ultimo que evalúa el METHOD INITIATE() de TDialog es ::AEvalWhen(). A lo mejor si le pones un WHEN al dialogo donde cambies el ::lTransparent de tu TSay y devuelva .T., consigues pintar el fondo de tu TSay. En caso contrario intenta poner ::lTransparent := .T. en el WHEN del TSAy. Si aún así no funciona, tendrás que implementar una nueva clase heredada de TSay que no utilice ::lTransparent .

Espero te sea de ayuda.

Un saludo.

Peaaaaaso de foro...

FWH 2007 - xHarbour - BCC55

Continue the discussion