FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Showing SVG-files with links
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Showing SVG-files with links
Posted: Mon Nov 09, 2015 07:39 PM

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.

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Showing SVG-files with links
Posted: Mon Nov 09, 2015 08:14 PM
Marc,

I just modified FWH\samples\webexp.prg this way and used this test.svg file:

Code (fw): Select all Collapse
#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


test.svg
Code (fw): Select all Collapse
<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>
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Showing SVG-files with links
Posted: Mon Nov 09, 2015 08:28 PM

Antonio,

Thank you for the example, but I got an error when compiling on

oActiveX&#058;

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Showing SVG-files with links
Posted: Mon Nov 09, 2015 08:56 PM

Marc,

Please replace it with:

oActiveX:bOnEvent

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Showing SVG-files with links
Posted: Mon Nov 09, 2015 10:17 PM
Antonio,

I get an error
    Error description: Error BASE/1004 Message not found: TACTIVEX:NAVIGATE[/list:u]
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Showing SVG-files with links
Posted: Tue Nov 10, 2015 07:35 AM

Antonio,

I got it working now.
Now I try to read the selection on the site back to my program.

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Showing SVG-files with links
Posted: Tue Nov 10, 2015 08:13 AM

Marc,

If you provide me the SVG fle that you are using I may try it here too :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Showing SVG-files with links
Posted: Tue Nov 10, 2015 11:05 AM

Antonio,

I will send it later this day.
Now, I am with a customer.

Mobiel verstuurd via Tapatalk

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Showing SVG-files with links
Posted: Tue Nov 10, 2015 06:54 PM

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.

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Showing SVG-files with links
Posted: Tue Nov 10, 2015 07:10 PM

Marc,

I got your file, I am going to review it asap, thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Showing SVG-files with links
Posted: Tue Nov 10, 2015 07:44 PM
Marc,

Please try this example. It is not perfect, but for now it is the closer that I have been able to do it:

Code (fw): Select all Collapse
#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 + CRLF
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Showing SVG-files with links
Posted: Tue Nov 10, 2015 09:07 PM

Thank you Antonio,

It's very nice already :D :D
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()

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Showing SVG-files with links
Posted: Tue Nov 10, 2015 09:19 PM

Marc,

Glad to know it may be useful for you :-)

Yes, that seems a good way to go

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Showing SVG-files with links
Posted: Wed Nov 11, 2015 10:27 AM
Antonio,

It's almost done!!
This is what I have changed:
Code (fw): Select all Collapse
 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(),) }


The only thing that I want to do is using a dialog instead ow a window, because my program have to wait until someone click a node, and than the program calls a new svg.
The variable sURL hold the link

The problem is that a Dialog doesn't work...
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Showing SVG-files with links
Posted: Wed Nov 11, 2015 11:51 AM

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

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite