Page 1 of 1

Folder Transparente com TWindow - Antonio

Posted: Fri Dec 28, 2007 12:46 pm
by Rossine
Olá Antonio,

Tem como usar a classe FOLDER dentro de uma WINDOW para que ela fique transparent igual ela fica da dialog ?

Veja a imagem abaixo usando o exemplo testfld3.prg

Image

Obrigado,

Rossine.

Posted: Sun Dec 30, 2007 4:05 pm
by Rossine
Olá,

Alguma dica sobre isto ? :cry:

Gracias,

Rossine.

Posted: Sun Dec 30, 2007 7:03 pm
by Antonio Linares
Rossine,

We don't find the difference :-( It looks as a default behavior of the Class TFolder (SysTabControl32) when it is placed on a dialog.

Please check this example and see how it automatically changes the color:

Code: Select all

// Dinamically building a folder ontop of a Dinamic DialogBox

#include "FiveWin.ch"

//----------------------------------------------------------------------------//

function Main()

   local oDlg, oFld

   DEFINE DIALOG oDlg TITLE "FiveWin Dynamic folders" ;
      FROM 5, 5 TO 20, 50 COLOR "N/G"

   @ 0.5, 1 FOLDER oFld PROMPT "&xBase", "&And OOP", "&Power" ;
      OF oDlg SIZE 160, 90

   @ 1, 1 BUTTON "&Hello" OF oFld:aDialogs[ 1 ] ;
     ACTION Another( oFld ) // MsgInfo( "Hello world!" )

   ACTIVATE DIALOG oDlg CENTERED

return nil

//----------------------------------------------------------------------------//

function Another( oFld )

   local oDlg

   // DEFINE WINDOW oWnd TITLE "FiveWin Dynamic folders" ;
   //    FROM 5, 5 TO 20, 50 COLOR "N/G"

   DEFINE DIALOG oDlg TITLE "FiveWin Dynamic folders" ;
      FROM 5, 5 TO 20, 50 COLOR "N/BG"
      
   // SetParent( oFld:hWnd, oWnd:hWnd )

   /*
   @ 0.5, 1 FOLDER oFld PROMPT "&xBase", "&And OOP", "&Power" ;
      OF oWnd SIZE 260, 180

   @ 1, 1 BUTTON "&Hello" OF oFld:aDialogs[ 1 ] ;
     ACTION MsgInfo( "Hello world!" ) SIZE 80, 20 
   */  

   ACTIVATE DIALOG oDlg ON INIT SetParent( oFld:hWnd, oDlg:hWnd )

return nil

//----------------------------------------------------------------------------//

Posted: Mon Dec 31, 2007 4:41 pm
by Rossine
Olá Antonio,

Usando com thema em .rc
1 24 "winxp\WindowsXP.Manifest"
é que acontece a diferença. Sem o thema tanto na dialog ou window o folder não fica transparente.

Segue abaixo o código para teste:

Code: Select all


// Dinamically building a folder ontop of a Dinamic DialogBox

#include "FiveWin.ch"

//----------------------------------------------------------------------------//

function Main()

   local oWnd, oFld

   DEFINE window oWnd TITLE "Using folders with Twindows" ;
            FROM 5, 5 TO 20, 50 color rgb(255,255,255), rgb(0,255,0)

   @ 0.5, 1 FOLDER oFld PROMPT "&xBase", "&And OOP", "&Power" ;
                OF oWnd SIZE 160, 90

   @ 1, 1 BUTTON "&Hello" OF oFld:aDialogs[ 1 ] ;
          ACTION another( oFld )

   ACTIVATE window oWnd

return NIL

function another( ofld )

   local oDlg

   DEFINE dialog odlg TITLE "Using folders with TDialog" ;
            FROM 5, 5 TO 20, 50 color rgb(255,255,255), rgb(0,255,0)

   ACTIVATE DIALOG oDlg ON INIT SetParent( oFld:hWnd, oDlg:hWnd ) 

return nil
Obrigado,

Rossine.

Posted: Wed Jan 02, 2008 11:49 am
by karinha
// Dinamically building a folder ontop of a Dinamic DialogBox

#include "FiveWin.ch"

//----------------------------------------------------------------------------//

Code: Select all

function Main()

   local oWnd, oFld

   DEFINE window oWnd TITLE "Using folders with Twindows" ;
            FROM 5, 5 TO 20, 50 color rgb(255,255,255), rgb(0,255,0)

   @ 0.5, 1 FOLDER oFld PROMPT "&xBase", "&And OOP", "&Power" ;
                OF oWnd SIZE 160, 90

   oFld:aDialogs[1]:bPainted := { || FillWnd ( oFld:aDialogs[1],            ;
                                               nRGB( 000, 255, 000 ) ) }

   @ 1, 1 BUTTON "&Hello" OF oFld:aDialogs[ 1 ] ;
          ACTION another( oFld )

   ACTIVATE window oWnd

return NIL

function another( ofld )

   local oDlg

   DEFINE dialog odlg TITLE "Using folders with TDialog" ;
            FROM 5, 5 TO 20, 50 color rgb(255,255,255), rgb(0,255,0)

   ACTIVATE DIALOG oDlg ON INIT SetParent( oFld:hWnd, oDlg:hWnd ) 

return nil

Function FoldResize( oWnd, oFld )

   Local oRect := oWnd:GetCliRect()

   oFld:Move( 0, 0, oRect:nRight - oRect:nLeft, ;
   oRect:nBottom - oRect:nTop , .T. )

Return Nil

Function FillWnd( oWnd, nColor, oBmp, nSaltos )

    Local hWnd    := oWnd:hWnd
    Local aRect   := GetClientRect( hWnd )
    Local oBrush, n
    Local nTop    := aRect[ 1 ]
    Local nBottom := aRect[ 3 ]
    Local nSteps
    Local nBlue, nRed, nGreen
    Local lPuro   := .F. // LoadIniPure() // Si es puro no hay degradado

    // Color de degradado
    DEFAULT nColor := 123123128 // LoadIni("MADRE","DegraDialog")

    IF !Empty( oBmp )
        IF UPPER(oWnd:ClassName()) == 'TDIALOG' // Si es un Dialogo
            oWnd:GetDC()
            PalBmpDraw( oWnd:hDC, 0, 0, oBmp:hBitmap )
            oWnd:ReleaseDC()
        ENDIF
        WndCenter( oBmp:hWnd, oWnd:hWnd )
    ENDIF

    If lPuro == .T.
        oWnd:SetColor( 0, nColor )
        oWnd:Refresh()
     Else
        lPuro := .F.
    Endif

    If !lPuro // El color no es puro, entonces degradado

       nBlue  := nRGBBlue( nColor )
       nRed   := nRGBRed( nColor )
       nGreen := nRGBGreen( nColor)

       DEFAULT nSaltos := 3

       nSteps := ( aRect[ 3 ] - aRect[ 1 ] ) / nSaltos

       oWnd:GetDC()

       aRect[ 3 ] = 0

       For N = 1 to nSteps

           aRect[ 3 ] += nSaltos

           DEFINE BRUSH oBrush COLOR RGB( nRed, nGreen, nBlue )

           FillRect( oWnd:hDC, aRect, oBrush:hBrush )

           RELEASE BRUSH oBrush

           aRect[ 1 ] += nSaltos

           nBlue -= 1
           nRed -= 1
           nGreen -= 1

           If nBlue  < 0 ; nBlue  += 1 ; Endif
           If nRed   < 0 ; nRed   += 1 ; Endif
           If nGreen < 0 ; nGreen += 1 ; Endif

        Next N

        oWnd:ReleaseDC()

    Endif

Return Nil

Posted: Wed Jan 02, 2008 1:04 pm
by Rossine
Olá João,

Obrigado por responder, mas o seu exemplo colore o interior do folder e não é isto que preciso :lol: Veja na imagem abaixo o quadrado em vermelho, é esta região que não está sendo preenchida na cor (verde) da TWindow, na TDialog ela é preenchida corretamente, isto em ambos _ usando o tema do XP dentro do .RC "1 24 "winxp\WindowsXP.Manifest"

Image

Obrigado mais uma vez, :wink:

Abraços,

Rossine.

Posted: Wed Jan 02, 2008 1:22 pm
by karinha
ROSSINE, AI, VOCE TEM QUE COLOCAR UMA BITMAP TRANSPARENTE NO DIALOGO.

Code: Select all

    DEFINE BRUSH oBrush FILE "CONTATO.BMP"

    DEFINE DIALOG oDlg  RESOURCE "BROWSE_CONTAS_A_PAGAR"                     ;
           BRUSH oBrush TRANSPARENT