Folder Transparente com TWindow - Antonio

Folder Transparente com TWindow - Antonio

Postby Rossine » Fri Dec 28, 2007 12:46 pm

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.
Rossine
 
Posts: 344
Joined: Tue Oct 11, 2005 11:33 am

Postby Rossine » Sun Dec 30, 2007 4:05 pm

Olá,

Alguma dica sobre isto ? :cry:

Gracias,

Rossine.
Rossine
 
Posts: 344
Joined: Tue Oct 11, 2005 11:33 am

Postby Antonio Linares » Sun Dec 30, 2007 7:03 pm

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  Expand view  RUN
// 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

//----------------------------------------------------------------------------//
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Rossine » Mon Dec 31, 2007 4:41 pm

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  Expand view  RUN

// 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.
Rossine
 
Posts: 344
Joined: Tue Oct 11, 2005 11:33 am

Postby karinha » Wed Jan 02, 2008 11:49 am

// Dinamically building a folder ontop of a Dinamic DialogBox

#include "FiveWin.ch"

//----------------------------------------------------------------------------//
Code: Select all  Expand view  RUN
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
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7872
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Postby Rossine » Wed Jan 02, 2008 1:04 pm

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 os casos usando o tema do XP dentro do .RC "1 24 "winxp\WindowsXP.Manifest"

Image

Obrigado mais uma vez, :wink:

Abraços,

Rossine.
Rossine
 
Posts: 344
Joined: Tue Oct 11, 2005 11:33 am

Postby karinha » Wed Jan 02, 2008 1:22 pm

ROSSINE, AI, VOCE TEM QUE COLOCAR UMA BITMAP TRANSPARENTE NO DIALOGO.

Code: Select all  Expand view  RUN
    DEFINE BRUSH oBrush FILE "CONTATO.BMP"

    DEFINE DIALOG oDlg  RESOURCE "BROWSE_CONTAS_A_PAGAR"                     ;
           BRUSH oBrush TRANSPARENT
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7872
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 29 guests