FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Dialog Transparent
Posts: 28
Joined: Sun Jan 08, 2012 06:17 PM
Dialog Transparent
Posted: Mon Mar 18, 2013 08:57 PM
amigos, quería poner un cuadro de diálogo acerca de otro diálogo para mantenerse en la cima era transparente y podía ver el contenido desde atrás. ¿Puede alguien darme un ejemplo?

Utilizar:
Code (fw): Select all Collapse
DEFINE DIALOG frmPDV RESORCE 'TELAPDV' TRANSPARENT
. No trabaja.
Utilizar:
Code (fw): Select all Collapse
DEFINE DIALOG frmPDV RESORCE 'TELAPDV'; frmPDV:lTrasparent:=.t.
. No trabaja.

Yo uso la opción PellesC transparente y además no funciona.
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Dialog Transparent
Posted: Mon Mar 18, 2013 10:38 PM
Puedes hacerlo asi:

ACTIVATE DIALOG oDlg ON INIT SetTrans( oDlg )

...

Code (fw): Select all Collapse
function SetTrans( oDlg ) 

   SetWindowLong( oDlg:hWnd, GWL_EXSTYLE, nOr( GetWindowLong( oDlg:hWnd, GWL_EXSTYLE ), WS_EX_LAYERED ) ) 

   SetLayeredWindowAttributes( oDlg:hWnd,,, LWA_COLORKEY ) 

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Dialog Transparent
Posted: Mon Mar 18, 2013 10:51 PM

Habia un ejemplo en el que podiamos establecer el nivel de transparencia de un diálogo, pero no lo localizo.

Alguien recuerda cual era ? gracias :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Dialog Transparent
Posted: Tue Mar 19, 2013 10:37 AM
Code (fw): Select all Collapse
oDlg:nOpacity  := 180
Posts: 28
Joined: Sun Jan 08, 2012 06:17 PM
Re: Dialog Transparent
Posted: Tue Mar 19, 2013 11:14 AM
Antonio Linares wrote:Puedes hacerlo asi:

ACTIVATE DIALOG oDlg ON INIT SetTrans( oDlg )

...

Code (fw): Select all Collapse
function SetTrans( oDlg ) 

   SetWindowLong( oDlg:hWnd, GWL_EXSTYLE, nOr( GetWindowLong( oDlg:hWnd, GWL_EXSTYLE ), WS_EX_LAYERED ) ) 

   SetLayeredWindowAttributes( oDlg:hWnd,,, LWA_COLORKEY ) 

return nil



Eso no sería VB?
Dado que el uso BRUSH oBRUSH TRANSPARENT funciona?
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: Dialog Transparent
Posted: Wed Mar 20, 2013 12:37 AM
Hola, Encontré este codigo por ahi. Nunca lo probé.

Code (fw): Select all Collapse
#include "FiveWin.ch"

Function Main()
local oGet, cSeguridad:=Space(12), ide:=Space(10)
local oBrush, para


Define Brush oBrush COLOR nRGB( 255, 106, 0 )
Define Dialog oDlgC ResName "demo"  Brush oBrush TRANSPARENT

  ReDefine Get oGet var ide        id 101 of oDlgC
  ReDefine Get oGet var cSeguridad id 102 of oDlgC

  ReDefine Button id 201 of oDlgC
  
  ReDefine Button id 202 of oDlgC;
  Action (oDlgC:End())
    
oDlgC:lHelpIcon:=.f.
Activate Dialog oDlgC Center;
On Init( Dialogo:= getwindowlong( oDlgC:hWnd, -20 ), ;
setwindowlong( oDlgC:hWnd, -20, nOr( Dialogo, 524288 ) ) , ;
setlayeredwindowattributes( oDlgC:hWnd, 0, 230, 2 ) )    // El parametro 230 
oBrush:End()                                             // es el nivel de transparencia 
Return Nil                                               // el el tope maximo es 255 entre
                                                                            // Menor seal este numero mas trasnparente sera 

DLL32 function getwindowlong( hwnd as LONG, index as LONG ) AS LONG PASCAL FROM "GetWindowLongA" lib "user32.dll"
DLL32 function setwindowlong( hwnd as LONG, index as LONG, newlog as LONG ) AS LONG PASCAL FROM "SetWindowLongA" lib "user32.dll"
DLL32 function setlayeredwindowattributes( hwnd as LONG, crkey as LONG, alpha as WORD, flag as LONG ) AS LONG PASCAL FROM "SetLayeredWindowAttributes" lib "user32.dll"

Saludos.
Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Dialog Transparent
Posted: Wed Mar 20, 2013 08:45 AM
Nixbeau,

Como ha comentado Anserkk, esta es la forma correcta para establecer un cierto nivel de transparencia:

Code (fw): Select all Collapse
#include "FiveWin.ch"

function Main()

   local oDlg

   DEFINE DIALOG oDlg

   oDlg:nOpacity = 100

   ACTIVATE DIALOG oDlg CENTERED

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1364
Joined: Wed Jun 21, 2006 12:39 AM
Re: Dialog Transparent
Posted: Wed Mar 20, 2013 01:14 PM

Sigue este hilo

viewtopic.php?f=6t=9963p=48289#p48289

Saludos

&&

Posts: 28
Joined: Sun Jan 08, 2012 06:17 PM
Re: Dialog Transparent
Posted: Wed Mar 20, 2013 09:28 PM
Antonio Linares wrote:Nixbeau,

Como ha comentado Anserkk, esta es la forma correcta para establecer un cierto nivel de transparencia:

Code (fw): Select all Collapse
#include "FiveWin.ch"

function Main()

   local oDlg

   DEFINE DIALOG oDlg

   oDlg:nOpacity = 100

   ACTIVATE DIALOG oDlg CENTERED

return nil



He utilizado el comando brillaba y parecía poner todo el formulario, incluyendo gets y says y memos.

He utilizado el comando: frmPDV: nOpacity = 100. ¿Cómo puedo obtener sólo el frmPDV (DIALOG) es transparente?

Dialog sólo necesita ser transparente, sin ningún otro componente.

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Dialog Transparent
Posted: Thu Mar 21, 2013 10:02 AM

Te refieres a que solo quieres que el fondo sea transparente ?

Puedes mostrar un dibujo de como quieres que se vea ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 28
Joined: Sun Jan 08, 2012 06:17 PM
Re: Dialog Transparent
Posted: Fri Mar 22, 2013 12:01 PM
Antonio Linares wrote:Te refieres a que solo quieres que el fondo sea transparente ?

Puedes mostrar un dibujo de como quieres que se vea ?



Hola Antonio, gracias por la ayuda.
Siga la imagen de como me gusta el trabajo form1.
De hecho, esta imagen representa mi necesidad, pero el uso de la relación trasnparencia pantalla se pone en la pantalla que cubre algunas partes y dejando otro visible. No necesariamente el desktop.

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Dialog Transparent
Posted: Fri Mar 22, 2013 12:06 PM

Prueba a usar un Brush NULL:

DEFINE BRUSH oBrush STYLE NULL

DEFINE DIALOG oDlg BRUSH oBrush ...

...

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 28
Joined: Sun Jan 08, 2012 06:17 PM
Re: Dialog Transparent
Posted: Fri Mar 22, 2013 12:48 PM
Antonio Linares wrote:Prueba a usar un Brush NULL:

DEFINE BRUSH oBrush STYLE NULL

DEFINE DIALOG oDlg BRUSH oBrush ...

...



Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Dialog Transparent
Posted: Fri Mar 22, 2013 09:26 PM
Code (fw): Select all Collapse
DEFINE DIALOG oDlg COLOR CLR_BLACK,RGB(1,1,1)
<...... place all controls ....>
oDlg:nSeeThroClr := RGB(1,1,1)
ACTIVATE DIALOG oDlg
Regards



G. N. Rao.

Hyderabad, India
Posts: 28
Joined: Sun Jan 08, 2012 06:17 PM
Re: Dialog Transparent
Posted: Fri Mar 22, 2013 09:42 PM
nageswaragunupudi wrote:
Code (fw): Select all Collapse
DEFINE DIALOG oDlg COLOR CLR_BLACK,RGB(1,1,1)
<...... place all controls ....>
oDlg:nSeeThroClr := RGB(1,1,1)
ACTIVATE DIALOG oDlg


Perfecto nageswaragunupudi, muy bueno. Funcionó a la perfección.
¿Podría explicar el funcionamiento del mando? Me gustaría entender por qué lo hace.