Pequeño problema con transparencias

Pequeño problema con transparencias

Postby jmartial » 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
jmartial
 
Posts: 458
Joined: Tue Mar 14, 2006 7:26 pm

Re: Pequeño problema con transparencias

Postby karinha » Wed Oct 22, 2014 1: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
User avatar
karinha
 
Posts: 7352
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Pequeño problema con transparencias

Postby Rick Lipkin » Wed Oct 22, 2014 1: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: Select all  Expand view

//--------------
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)
 
User avatar
Rick Lipkin
 
Posts: 2636
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Pequeño problema con transparencias

Postby jmartial » Wed Oct 22, 2014 3: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
jmartial
 
Posts: 458
Joined: Tue Mar 14, 2006 7:26 pm

Re: Pequeño problema con transparencias

Postby karinha » Wed Oct 22, 2014 5:17 pm

Code: Select all  Expand view

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
User avatar
karinha
 
Posts: 7352
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Pequeño problema con transparencias

Postby antolin » Fri Oct 24, 2014 4: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...
antolin
 
Posts: 492
Joined: Thu May 10, 2007 8:30 pm
Location: Sevilla


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 35 guests