// \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