Hi,
Does anyone have an example showing a SVG-file in a FW-window including the posibility returning the info of the hiperlink after clicking it.
Marc
FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Hi,
Does anyone have an example showing a SVG-file in a FW-window including the posibility returning the info of the hiperlink after clicking it.
#include "FiveWin.ch"
function Main()
local oWnd, oActiveX
local cEvents := ""
DEFINE WINDOW oWnd TITLE "FiveWin ActiveX Support"
@ 0, 0 ACTIVEX oActiveX PROGID "Shell.Explorer" OF oWnd
oWnd:oClient = oActiveX // To fill the entire window surface
oActiveX : Navigate( hb_CurDrive() + ":\"+CurDir()+"\test.svg" )
oActiveX : bOnEvent = { | event, aParams, pParams | cEvents += EventInfo( event, aParams, pParams, oActiveX ) }
ACTIVATE WINDOW oWnd ;
VALID ( MemoEdit( cEvents ), .t. )
return nil
function EventInfo( event, aParams, pParams, oActiveX )
local cMsg := "Event: " + cValToChar( event ) + CRLF
local n
cMsg += "Params: " + CRLF
for n = 1 to Len( aParams )
cMsg += cValToChar( aParams[ n ] ) + CRLF
next
if event == "BeforeNavigate2"
// MsgInfo( aParams[ 2 ] )
// SetEventParam( pParams, 7, .t. ) // Comment this to allow navigation
endif
return cMsg + CRLF<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<rect x="10" y="10" height="100" width="100"
style="stroke:#ff0000; fill: #0000ff"/>
</svg>Antonio,
Thank you for the example, but I got an error when compiling on
oActiveX:
Marc,
Please replace it with:
oActiveX:bOnEvent
Antonio,
I got it working now.
Now I try to read the selection on the site back to my program.
Marc,
If you provide me the SVG fle that you are using I may try it here too ![]()
Antonio,
I will send it later this day.
Now, I am with a customer.
Mobiel verstuurd via Tapatalk
Antonio,
Did you received my example?
Is there a way that the window close after clicking a node?
I was thinking to do a test in the EventInfo-function, that someone clicked a node, and then close the window, and return the URL, but I don't know what event-name I have to use.
Marc,
I got your file, I am going to review it asap, thanks
#include "FiveWin.ch"
function Main()
local oWnd, oActiveX
local lCompleted := nil
local cEvents := ""
local nTimes := 0
DEFINE WINDOW oWnd TITLE "FiveWin ActiveX Support"
@ 0, 0 ACTIVEX oActiveX PROGID "Shell.Explorer" OF oWnd
// oActiveX:bLClicked = { || MsgInfo( "onclick" ) }
oWnd:oClient = oActiveX // To fill the entire window surface
oActiveX:Navigate( hb_CurDrive() + ":\" + CurDir() + "\test.svg" )
oActiveX:bOnEvent = { | event, aParams, pParams | cEvents += EventInfo( event, aParams, pParams, oActiveX ),;
If( event == "StatusTextChange" .and. ;
Left( aParams[ 1 ], 5 ) == "file:", MsgInfo( aParams[ 1 ] ),) }
ACTIVATE WINDOW oWnd ;
VALID ( MemoEdit( cEvents ), .t. )
return nil
function EventInfo( event, aParams, pParams, oActiveX )
local cMsg := "Event: " + cValToChar( event ) + CRLF
local n
cMsg += "Params: " + CRLF
for n = 1 to Len( aParams )
cMsg += cValToChar( aParams[ n ] ) + CRLF
next
if event == "BeforeNavigate2"
// MsgInfo( aParams[ 2 ] )
// SetEventParam( pParams, 7, .t. ) // Comment this to allow navigation
endif
return cMsg + CRLFThank you Antonio,
It's very nice already
Now I will look further to find a way to only execute a function, only when someone click on the node, because now, it will directly select if the mouse is over the node.
I will try to replace the MsgInfo( aParams[ 1 ] ) in the oActiveX:bOnEvent with to another function that also check if the mouse is clicked, and then close the window with oWnd:end()
Marc,
Glad to know it may be useful for you ![]()
Yes, that seems a good way to go
static sLoaded
static sURL := ''
oActiveX:bOnEvent = { | event, aParams, pParams | cEvents += EventInfo( event, aParams, pParams, oActiveX ),;
If( event == "StatusTextChange" .and. ;
Left( aParams[ 1 ], 5 ) == "file:", sURL := aParams[ 1 ] ,), ;
If( event == "DocumentComplete" , sLoaded := .t.,),;
If( event == "NavigateComplete2" .and. sLoaded, oWnd:end(),) }Antonio,
I have found a solution with the StopUntil() function.
Now I'm waiting until someone click a node. Then the window is closed, and I know the sURL variable