Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » how to open a URL in default browser?
icon11.gif  how to open a URL in default browser? [message #22796] Mon, 17 August 2009 12:09 Go to next message
bonami is currently offline  bonami
Messages: 186
Registered: June 2007
Location: Beijing
Experienced Member
I'd like to provide a URL in my window, by RichTextCtrl.
But how to open it? Thinking about system(). But don't know what default browser is, so cannot achieve this.
Even under Windows, this seems a problem, too. "explorer http://..." may work. But not satisfactory to me anyway.
Re: how to open a URL in default browser? [message #22797 is a reply to message #22796] Mon, 17 August 2009 13:15 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

In QTF links can be created in following way:
[^http://ultimatepp.org^ Ultimate`+`+]

To my best knowledge, it opens link in default browser (using xdg-open on my Ubuntu, not sure how windows solution works).

More details can be found in manual.
Re: how to open a URL in default browser? [message #22798 is a reply to message #22797] Mon, 17 August 2009 13:45 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
As dolik.rce correctly explained, you can just put link into QTF.

But maybe we owe you more detailed explanation. There is

	Callback1<const String&> WhenLink;


in RichTextView (RichTextCtrl base). If you click on link in RichText, this one gets invoked.

Its default value points to

void    LaunchWebBrowser(const String& url)


which attempts to open default system browser with given url (see implementation for nasty details Smile

Mirek
icon14.gif  Re: how to open a URL in default browser? [message #22808 is a reply to message #22796] Tue, 18 August 2009 10:33 Go to previous message
bonami is currently offline  bonami
Messages: 186
Registered: June 2007
Location: Beijing
Experienced Member
OIC. I implemented WhenLink myself, so came the trouble.
Thanks.
Previous Topic: Couldn't enable LLOG in X11Wnd.cpp
Next Topic: return value suggestion to TimeStop
Goto Forum:
  


Current Time: Tue Apr 16 15:24:18 CEST 2024

Total time taken to generate the page: 0.01267 seconds