wxHTMLHelpController and external links ? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

wxHTMLHelpController and external links ?

Post by benedicte » Fri Aug 19, 2005 9:36 am

It seems the wxHTMLHelpController cannot open links to standard URL (http://, ...), even when specifying a target window.
eg <a href="www.wxforum.org" target="_blank">link</a>

Is there something special to do ?

________________________
wxMSW 2.6.1 on win 2k, XP Home/Pro
wxGTK 2.6.1 on Debian

Muskelkatermann
Earned some good credits
Earned some good credits
Posts: 135
Joined: Thu Apr 28, 2005 11:36 am
Location: Gie

Post by Muskelkatermann » Fri Aug 19, 2005 9:42 am

Hi,

well my HTML Time is far in Past but I remember an external link must be look like this:

Code: Select all

<a href="http://www.wxforum.org" target="_blank">link</a> 
Next thing, but I'm not sure about it, I think you have to download the File manually with wxURL for Example, but this is only an Assumption.
I think I've seen that somewhere.


Greetings

benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte » Fri Aug 19, 2005 9:55 am

I checked and changed my URLS to http://... but I am still not able to open the links...

I don't use wxURL, as the ZIP/HTB file is directly opened in the help viewer. I don't handle any event there.

btw, the CHM version of the help file works well, and the original HTML files too.

SnakeChomp
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 235
Joined: Sun Oct 10, 2004 2:53 am
Contact:

Post by SnakeChomp » Fri Aug 19, 2005 11:48 am

I highly doubt that the primitive wxHTML control is able to load external links. Even if it could, it wouldn't be able to render them not supporting much of the HTML standard. Spawning a browser window (wxOpenDefaultBrowser or whatever its called) would be the easiest route.

ssigala
Earned some good credits
Earned some good credits
Posts: 109
Joined: Fri Sep 03, 2004 9:30 am
Location: Brescia, Italy

Re: wxHTMLHelpController and external links ?

Post by ssigala » Fri Aug 19, 2005 12:17 pm

benedicte wrote:It seems the wxHTMLHelpController cannot open links to standard URL (http://, ...), even when specifying a target window.
eg <a href="www.wxforum.org" target="_blank">link</a>

Is there something special to do ?
If you would like to launch the default browser on external links, I have published some time ago on wxWiki a way to do this:

http://wiki.wxwidgets.org/wiki.pl?Calli ... HtmlWindow

Hope it helps,
Sandro
Sandro Sigala - Kynosoft, Brescia

benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte » Fri Aug 19, 2005 12:30 pm

I don't need to launch a browser. I was thinking the HTML Help controller would do it by itself :!:

All the links internal to my publication work fine, but I cannot make a link to any website (such as http://www.wxwidgets.org/ :wink: )

benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte » Mon Aug 22, 2005 4:38 pm

I will make sure the URL full address is visible (either in a tooltip, or by any other mean) so that the user will be able to type it into his/her web browser.

That's the only solution I found.

benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte » Fri Feb 24, 2006 9:20 am

I just add a reply in case someone finds this thread when looking for a similar problem.

I have added

Code: Select all

wxFileSystem::AddHandler(new wxInternetFSHandler);
in myApp::OnInit()

:!: do not forget to:

Code: Select all

#include "wx/fs_inet.h"
and wxbase26[d]_net.lib in the list of librairies I link my app with.

:) The result is quite good, as the web pages are displayed in the HTML help browser....
:( BUT, all the websites I link to (wxWidgets, my website, ...) require frames, forms, or Javascript... and the HTML help browser do not support them...

:arrow: Conclusion:
I leave my help file as it is, with tooltips containing the target URL.

Special thanks to Ksmith22, and this thread.

lanczyck
Earned a small fee
Earned a small fee
Posts: 14
Joined: Wed May 17, 2006 11:36 pm
Location: Washington, DC

how tell wxHtmlHelpController to use subclassed wxHtmlWindow

Post by lanczyck » Wed May 17, 2006 11:45 pm

Hi,
I like the solution to this problem Sandro presented in the wiki:

http://wiki.wxwidgets.org/wiki.pl?Calli ... HtmlWindow

The solution involves subclassing wxHtmlWindow to allow the handler to launch an external browser. My question is: how do I get the help controller to use a subclass of wxHtmlWindow?? I see no API that allows me to set the wxHtmlWindow object, and unfortunately do not have the option of modifying the wxWidgets source code.

Thanks,
Chris

benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte » Thu May 18, 2006 9:22 am

maybe derive the help controller itself?

lanczyck
Earned a small fee
Earned a small fee
Posts: 14
Joined: Wed May 17, 2006 11:36 pm
Location: Washington, DC

Post by lanczyck » Thu May 18, 2006 2:45 pm

A wxFrame-derived class actually owns the wxHelpWindow, but subclassing that or the help controller solves the problem. Thanks for the help :-)
Chris

benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte » Thu May 18, 2006 2:47 pm

If you get it to work, can you post your code in the "Code Dump" section of this forum?

lanczyck
Earned a small fee
Earned a small fee
Posts: 14
Joined: Wed May 17, 2006 11:36 pm
Location: Washington, DC

Code snippet posted

Post by lanczyck » Mon Jul 17, 2006 9:25 pm

Hi,
We finally implemented the necessary code. As requested, it's at:

http://forums.wxwidgets.org/viewtopic.php?p=41712#41712

Cheers,
Chris

Post Reply