Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat Jul 22, 2017 5:53 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: HTMLViewer link handling
PostPosted: Wed Aug 22, 2012 8:54 pm 
Offline

Joined: Mon Aug 15, 2011 10:25 pm
Posts: 293
I am using a HTMLViewer with LoadPage and passing in an imported HTML page
me.LoadPage default, Nil


Now, I want any links in the HTML to be clickable, so I follow Christian's advice from his posting to the mailing list, but make some modifications as I am not loading a webpage hosted on a server
Function CancelLoad(URL as String) As Boolean
// http://support.realsoftware.com/listarchives/realbasic-nug/2010-02/msg00873.html - Christian Schmitz

const kEventHandled = TRUE
const kEventNotHandled = FALSE

if (url = "about:blank") OR (url.Left(4) = "file") OR (url.Left(2) = "C:") then // about:blank is for Mac OS X WebKit, file is for Win32 WebKit and C: is for Win32 native
Return kEventNotHandled
else
ShowURL(url)
Return kEventHandled
end if
End Function


The first "if" line will make sure our page loads on the different OSes and with the different web browsers (sorry Linux users, I cannot seem to get the HTMLViewer to work in on my install)..

The URL parameter will contain one of the following:
"about:blank" on Mac OS X webkit
an absolute file path to the temp file, starting with "file:///" on Win32 webkit
an absolute file path to the temp file, starting with "C:\" on Win32 native renderer

Remember, this is only when you are passing in HTML source to the LoadPage.. Hopefully that makes sense and helps someone out :-)
-Sean


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group