Showing SVG-files with links

Showing SVG-files with links

Postby Marc Vanzegbroeck » Mon Nov 09, 2015 7: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
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Showing SVG-files with links

Postby Antonio Linares » Mon Nov 09, 2015 8:14 pm

Marc,

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

Code: Select all  Expand view
#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: Select all  Expand view
<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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Showing SVG-files with links

Postby Marc Vanzegbroeck » Mon Nov 09, 2015 8: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
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Showing SVG-files with links

Postby Antonio Linares » Mon Nov 09, 2015 8:56 pm

Marc,

Please replace it with:

oActiveX:bOnEvent
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Showing SVG-files with links

Postby Marc Vanzegbroeck » Mon Nov 09, 2015 10:17 pm

Antonio,

I get an error
    Error description: Error BASE/1004 Message not found: TACTIVEX:NAVIGATE
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Showing SVG-files with links

Postby Marc Vanzegbroeck » Tue Nov 10, 2015 7: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
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Showing SVG-files with links

Postby Antonio Linares » Tue Nov 10, 2015 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Showing SVG-files with links

Postby Marc Vanzegbroeck » 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
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Showing SVG-files with links

Postby Marc Vanzegbroeck » Tue Nov 10, 2015 6: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
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Showing SVG-files with links

Postby Antonio Linares » Tue Nov 10, 2015 7:10 pm

Marc,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Showing SVG-files with links

Postby Antonio Linares » Tue Nov 10, 2015 7: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: Select all  Expand view
#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&#058;bLClicked = { || MsgInfo( "onclick" ) }

   oWnd:oClient = oActiveX // To fill the entire window surface

   oActiveX&#058;Navigate( hb_CurDrive() + ":\" + CurDir() + "\test.svg" )

   oActiveX&#058;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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Showing SVG-files with links

Postby Marc Vanzegbroeck » Tue Nov 10, 2015 9: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
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Showing SVG-files with links

Postby Antonio Linares » Tue Nov 10, 2015 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Showing SVG-files with links

Postby Marc Vanzegbroeck » Wed Nov 11, 2015 10:27 am

Antonio,

It's almost done!!
This is what I have changed:
Code: Select all  Expand view
static sLoaded
static sURL := ''

    oActiveX&#058;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
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Showing SVG-files with links

Postby Marc Vanzegbroeck » 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
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 62 guests