Page 1 of 1
Ajustar contenido página web en control TDockPnel
Posted: Sun Feb 07, 2021 1:18 am
by leandro
Buenas noches para todos, tengo otra pregunta.
Estoy intentando cargar el contenido de una pagina web en un control TDockPnel, siguiendo el ejemplo que publico nuestro amigo Cristobal, logramos que se muestre la pagina web como la primera imagen, el problema es que necesitamos que se muestre como segunda imagen (STRETCH).
Code: Select all
Function ShowPageWeb( o, nT, nL, nH, nW )
local oActiveX
oActiveX := CreateObject( "InternetExplorer.Application" )
WITH OBJECT oActiveX
:Visible := .t.
:ToolBar := .f.
:StatusBar := .f.
:MenuBar := .f.
:FullScreen := .t.
:Invoke( "Navigate", "https://www.google.com/" )
END
Return oActiveX
El resultado :
Pero lo que necesitamos lograr es lo siguiente:
Re: Ajustar contenido página web en control TDockPnel
Posted: Sun Feb 07, 2021 4:00 am
by cnavarro
Leandro, prueba asi a ver:
Code: Select all
//----------------------------------------------------------------------------//
// ( C ) Cristobal Navarro - 2021
// TDockPnel with ActiveX
//----------------------------------------------------------------------------//
#include "Fivewin.ch"
#include "colores.ch"
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Static oWindow
Static nWAncho
Static nWAlto
Static nCol
Static nRow
Static oFont4
Static cPathApp
Static oDock1
Static oDock2
Static oDock3
Static oDock4
Static oDock5
Static cText := ""
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Function Main()
local cFont := "Segoe UI Symbol" //TAHOMA //CALIBRI
DEFINE FONT oFont4 NAME "CALIBRI" SIZE 0,-16
TestDockPnel()
oFont4:End()
Return nil
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Static Function TestDockPnel()
local nCol
local nRow
nWAncho := Int( GetSysMetrics( 0 ) * 0.95 )
nWAlto := Int( GetSysMetrics( 1 ) * 0.95 )
nCol := Int( ( GetSysMetrics( 0 ) - nWAncho ) / 2 )
nRow := Int( ( GetSysMetrics( 1 ) - nWAlto ) / 2 )
DEFINE WINDOW oWindow FROM nRow, nCol TO nWAlto + nRow, nWAncho + nCol ; //MDI ;
PIXEL TITLE "Test TDockPnel Control ActiveX - " + FWVERSION ;
COLOR CLR_WHITE, Rgb( 182, 182, 182 )
CreaDocks()
ACTIVATE WINDOW oWindow
Return nil
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Function CreaDocks()
local cUrl := "www.google.es"
oDock1 := TDockPnel():New( oWindow )
WITH OBJECT oDock1
:SetHeightCaption( 24 )
:SetCoors( { | o | 2 }, { | o | 2 }, ;
{ | o | o:oWnd:nHeight - 42 }, ;
{ | o | o:oWnd:nWidth - 20 } )
:SetCaption( { | o | cUrl } )
:SetColors( CLR_WHITE, METRO_RED, Rgb( 88, 88, 88 ), CLR_WHITE )
:SetFont( oFont4 )
:SetBorderSize( 1 )
:SetImgsFiles( { { "..\bitmaps\16x16\options.bmp", { | o | MyPopupMnu( o ) }, "ToolTip" } } )
:SetCtrlsPnel( { | o, nT, nL, nH, nW, oB | oB := ShowPageWeb( o, cUrl, nT, nL, nH, nW ) } )//, ;
// SetParent( oB:hWnd, o:hWnd ) } )
:Activate()
END
Return nil
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Function MyPopupMnu( o )
local oMnu
local nRow := o:nTop + Int( o:nHeight / 2 )
local nCol := o:nLeft + Int( o:nWidth / 2 )
MENU oMnu POPUP 2013 ;
COLORSELECT METRO_STEEL, METRO_STEEL, CLR_WHITE ;
COLORMENU CLR_WHITE, CLR_BLUE ;
COLORSEPARATOR METRO_STEEL ;
COLORLEFT CLR_WHITE ;
FONT oFont4
MENUITEM "Info" ACTION MsgInfo( "Class TDockPnel" )
SEPARATOR
MENUITEM "Exit" ACTION oWindow:End()
ENDMENU
ACTIVATE MENU oMnu AT nRow, nCol OF o:oWnd
Return oMnu
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Function ShowPageWeb( oParent, cUrl, nT, nL, nH, nW )
local oActX
oActX := TActiveX():New( oParent, "Shell.Explorer.2", nT, nL, nW, nH )
oActX:Do( "Navigate", cUrl )
Return oActX
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Re: Ajustar contenido página web en control TDockPnel
Posted: Sun Feb 07, 2021 11:36 am
by leandro
Cristobal, gracias por responder.
Aun que ya se ajusta, ahora me salen errores de script, lo que no sucedía haciendo el llamado de la otra manera.
Re: Ajustar contenido página web en control TDockPnel
Posted: Sun Feb 07, 2021 12:58 pm
by cnavarro
Leandro, no es un problema de TDockPnel, lo mismo ocurre si lo envías sobre una TWindow
Para que te aparezca correctamente, el contenedor ha de estar maximizado
Code: Select all
//----------------------------------------------------------------------------//
// ( C ) Cristobal Navarro - 2021
// TDockPnel with ActiveX
//----------------------------------------------------------------------------//
#include "Fivewin.ch"
#include "colores.ch"
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Static oWindow
Static nWAncho
Static nWAlto
Static nCol
Static nRow
Static oFont4
Static cPathApp
Static oDock1
Static oDock2
Static oDock3
Static oDock4
Static oDock5
Static cText := ""
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Function Main()
local cFont := "Segoe UI Symbol" //TAHOMA //CALIBRI
DEFINE FONT oFont4 NAME "CALIBRI" SIZE 0,-16
TestDockPnel()
oFont4:End()
Return nil
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Static Function TestDockPnel()
local nCol
local nRow
nWAncho := Int( GetSysMetrics( 0 ) * 0.95 )
nWAlto := Int( GetSysMetrics( 1 ) * 0.95 )
nCol := Int( ( GetSysMetrics( 0 ) - nWAncho ) / 2 )
nRow := Int( ( GetSysMetrics( 1 ) - nWAlto ) / 2 )
DEFINE WINDOW oWindow FROM nRow, nCol TO nWAlto + nRow, nWAncho + nCol ; //MDI ;
PIXEL TITLE "Test TDockPnel Control ActiveX - " + FWVERSION ;
COLOR CLR_WHITE, Rgb( 182, 182, 182 )
ACTIVATE WINDOW oWindow MAXIMIZED ON INIT CreaDocks()
Return nil
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Function CreaDocks()
local cUrl := "www.google.es"
oDock1 := TDockPnel():New( oWindow )
WITH OBJECT oDock1
:SetHeightCaption( 24 )
:SetCoors( { | o | 2 }, { | o | 2 }, ;
{ | o | o:oWnd:nHeight - 42 }, ;
{ | o | o:oWnd:nWidth - 20 } )
:SetCaption( { | o | cUrl } )
:SetColors( CLR_WHITE, METRO_RED, Rgb( 88, 88, 88 ), CLR_WHITE )
:SetFont( oFont4 )
:SetBorderSize( 1 )
:SetImgsFiles( { { "..\bitmaps\16x16\options.bmp", { | o | MyPopupMnu( o ) }, "ToolTip" } } )
:SetCtrlsPnel( { | o, nT, nL, nH, nW, oB | oB := ShowPageWeb( o, cUrl, nT, nL, nH, nW ) } )//, ;
// SetParent( oB:hWnd, o:hWnd ) } )
:Activate()
END
Return nil
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Function MyPopupMnu( o )
local oMnu
local nRow := o:nTop + Int( o:nHeight / 2 )
local nCol := o:nLeft + Int( o:nWidth / 2 )
MENU oMnu POPUP 2013 ;
COLORSELECT METRO_STEEL, METRO_STEEL, CLR_WHITE ;
COLORMENU CLR_WHITE, CLR_BLUE ;
COLORSEPARATOR METRO_STEEL ;
COLORLEFT CLR_WHITE ;
FONT oFont4
MENUITEM "Info" ACTION MsgInfo( "Class TDockPnel" )
SEPARATOR
MENUITEM "Exit" ACTION oWindow:End()
ENDMENU
ACTIVATE MENU oMnu AT nRow, nCol OF o:oWnd
Return oMnu
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Function ShowPageWeb( oParent, cUrl, nT, nL, nH, nW )
local oActX
//oActX := CreateObject( "InternetExplorer.Application", "IE_" )
oActX := CreateObject( "{D5E8041D-920F-45e9-B8FB-B1DEB82C6E5E}", "IE_" )
WITH OBJECT oActX
:Visible := .t.
:ToolBar := .f.
:StatusBar := .f.
:MenuBar := .f.
:FullScreen := .T.
:Invoke( "Navigate", cURL )
END
SetParent( oActX:hWnd, oParent:hWnd )
Return oActX
//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//
Re: Ajustar contenido página web en control TDockPnel
Posted: Sun Feb 07, 2021 1:23 pm
by leandro
Gracias por responder amigo
No te preocupes se que el error no es de tu clase, gracias por la ayuda.
Pero ahora me esta devolviendo este error.
Code: Select all
Application
===========
Path and name: C:\fwh1909\samples\leandro10.exe (32 bits)
Size: 3,971,072 bytes
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20190613)
FiveWin version: FWH 19.09
C compiler version: Borland/Embarcadero C++ 7.3 (32-bit)
Windows version: 6.2, Build 9200
Time from start: 0 hours 0 mins 0 secs
Error occurred at: 02/07/21, 08:20:40
Error description: Error TOleAuto/65535 : TOLEAUTO:NEW
Args:
[ 1] = C {D5E8041D-920F-45e9-B8FB-B1DEB82C6E5E}
[ 2] = U
[ 3] = C IE_
Stack Calls
===========
Called from: => THROW( 0 )
Called from: source\rtl\win32ole.prg => TOLEAUTO:NEW( 0 )
Called from: source\rtl\win32ole.prg => CREATEOBJECT( 0 )
Called from: leandro10.prg => SHOWPAGEWEB( 131 )
Called from: leandro10.prg => (b)CREADOCKS( 88 )
Called from: .\source\internal\TDOCKPNEL.PRG => TDOCKPNEL:PAINTPNELH( 814 )
Called from: .\source\internal\TDOCKPNEL.PRG => TDOCKPNEL:PAINTCTRLSPNELP( 739 )
Called from: .\source\internal\TDOCKPNEL.PRG => (b)TDOCKPNEL:CREATEPNELP( 660 )
Called from: .\source\classes\TPANEL.PRG => TPANEL:PAINT( 162 )
Called from: .\source\classes\TPANEL.PRG => (b)TPANEL:TPANEL( 23 )
Called from: => TPANEL:DISPLAY( 0 )
Called from: .\source\classes\CONTROL.PRG => TPANEL:HANDLEEVENT( 1767 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3559 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE( 1097 )
Called from: leandro10.prg => TESTDOCKPNEL( 65 )
Called from: leandro10.prg => MAIN( 41 )
Re: Ajustar contenido página web en control TDockPnel
Posted: Sun Feb 07, 2021 1:27 pm
by karinha
Leandro, intenta ahora:
Code: Select all
// \SAMPLES\TDOCP2.PRG
//----------------------------------------------------------------------------//
// ( C ) Cristobal Navarro - 2021
// TDockPnel with ActiveX
//----------------------------------------------------------------------------//
#include "Fivewin.ch"
#include "colores.ch"
Static oWindow
Static nWAncho
Static nWAlto
Static nCol
Static nRow
Static oFont4
Static cPathApp
Static oDock1
Static oDock2
Static oDock3
Static oDock4
Static oDock5
Static cText := ""
Function Main()
local cFont := "Segoe UI Symbol" //TAHOMA //CALIBRI
DEFINE FONT oFont4 NAME "CALIBRI" SIZE 0,-16
TestDockPnel()
oFont4:End()
Return nil
Static Function TestDockPnel()
local nCol
local nRow
nWAncho := Int( GetSysMetrics( 0 ) * 0.95 )
nWAlto := Int( GetSysMetrics( 1 ) * 0.95 )
nCol := Int( ( GetSysMetrics( 0 ) - nWAncho ) / 2 )
nRow := Int( ( GetSysMetrics( 1 ) - nWAlto ) / 2 )
DEFINE WINDOW oWindow FROM nRow, nCol TO nWAlto + nRow, nWAncho + nCol ; //MDI ;
PIXEL TITLE "Test TDockPnel Control ActiveX - " + FWVERSION ;
COLOR CLR_WHITE, Rgb( 182, 182, 182 )
CreaDocks()
ACTIVATE WINDOW oWindow
Return nil
Function CreaDocks()
// local cUrl := "www.google.es"
local cUrl := "www.google.com"
oDock1 := TDockPnel():New( oWindow )
WITH OBJECT oDock1
:SetHeightCaption( 24 )
:SetCoors( { | o | 2 }, { | o | 2 }, ;
{ | o | o:oWnd:nHeight - 42 }, ;
{ | o | o:oWnd:nWidth - 20 } )
:SetCaption( { | o | cUrl } )
:SetColors( CLR_WHITE, METRO_RED, Rgb( 88, 88, 88 ), CLR_WHITE )
:SetFont( oFont4 )
:SetBorderSize( 1 )
:SetImgsFiles( { { "..\bitmaps\16x16\options.bmp", { | o | MyPopupMnu( o ) }, "ToolTip" } } )
:SetCtrlsPnel( { | o, nT, nL, nH, nW, oB | oB := ShowPageWeb( o, cUrl, nT, nL, nH, nW ) } )//, ;
// SetParent( oB:hWnd, o:hWnd ) } )
:Activate()
END
Return nil
Function MyPopupMnu( o )
local oMnu
local nRow := o:nTop + Int( o:nHeight / 2 )
local nCol := o:nLeft + Int( o:nWidth / 2 )
MENU oMnu POPUP 2013 ;
COLORSELECT METRO_STEEL, METRO_STEEL, CLR_WHITE ;
COLORMENU CLR_WHITE, CLR_BLUE ;
COLORSEPARATOR METRO_STEEL ;
COLORLEFT CLR_WHITE ;
FONT oFont4
MENUITEM "Info" ACTION MsgInfo( "Class TDockPnel" )
SEPARATOR
MENUITEM "Exit" ACTION oWindow:End()
ENDMENU
ACTIVATE MENU oMnu AT nRow, nCol OF o:oWnd
Return oMnu
Function ShowPageWeb( oParent, cUrl, nT, nL, nH, nW )
local oActiveX, oHttp, oActiveXdo
oActiveX := TActiveX():New( oParent, "Shell.Explorer.2", nT, nL, nW, nH )
oActivex:Silent := .T. // aqui silence... en el script.
oActiveX:Do( "Navigate", cUrl )
oActivex:SetFocus()
WHILE oActivex:Busy
SysWait(.2)
ENDDO
oActiveXdo := oActiveX:Document()
oHttp := oActiveX:GetProp( "Document" ) // -> Object Document
IF Empty( oHttp )
MsgInfo( "Problemas en el Site...", ;
"Problemas en el Site..." )
RETURN( .F. )
ENDIF
Return oActiveX
// Fin
Saludos.
Re: Ajustar contenido página web en control TDockPnel
Posted: Sun Feb 07, 2021 1:28 pm
by karinha
Function ShowPageWeb( oParent, cUrl, nT, nL, nH, nW )
local oActiveX, oHttp, oActiveXdo
oActiveX := TActiveX():New( oParent, "Shell.Explorer.2", nT, nL, nW, nH )
oActivex:Silent := .T. // aqui silence... en el script.
oActiveX:Do( "Navigate", cUrl )
oActivex:SetFocus()
WHILE oActivex:Busy
SysWait(.2)
ENDDO
oActiveXdo := oActiveX:Document()
oHttp := oActiveX:GetProp( "Document" ) // -> Object Document
IF Empty( oHttp )
MsgInfo( "Problemas en el Site...", ;
"Problemas en el Site..." )
RETURN( .F. )
ENDIF
Return oActiveX
Re: Ajustar contenido página web en control TDockPnel
Posted: Sun Feb 07, 2021 2:07 pm
by leandro
Gracias por responder
Ya no muestra lo errores, pero ahora el problema es que la pagina no se muestra bien, parece que los estilos css no se cargan.
La página el navegador
https://hymplus.com/
Así se ve en el contenedor
Re: Ajustar contenido página web en control TDockPnel
Posted: Sun Feb 07, 2021 2:48 pm
by karinha
Leandro, en tu caso, és mejor que hagas asi:
Code: Select all
// \SAMPLES\LEANDRO.PRG
#Include "FiveWin.ch"
STATIC oWnd
FUNCTION Main()
Llama_hymplus()
RETURN NIL
FUNCTION Llama_hymplus()
LOCAL oOle
LOCAL chymplus
chymplus := "https://hymplus.com/"
DEFINE WINDOW oWnd FROM -10, -10 TO -5, -5
ACTIVATE WINDOW oWnd ;
ON INIT( ShellExecute(GetActiveWindow(),"open",'"'+chymplus+'"'), oWnd:End() )
RETURN NIL
// Fin
Saludos.
Re: Ajustar contenido página web en control TDockPnel
Posted: Sun Feb 07, 2021 4:16 pm
by leandro
karinha, gracias por responder.
Pero el código que me enviaste lo que hace es abrir una ventana del navegador directo a nuestro sitio web, pero lo que necesitamos es que este quede contenido dentro del control TDockPnel.
Re: Ajustar contenido página web en control TDockPnel
Posted: Sun Feb 07, 2021 8:50 pm
by cnavarro
Leandro, con el último código que te envié a mí me funciona correctamente simplemente cambiando la url
Si no te funciona, envíame un correo