HTMLViewer Control in REALbasic line

HTMLViewer available in REALbasic is a great control to render HTML files and web pages. It can be used for example for building a simple web browser, HTML editor or file browser. Learn how can you get the best from HTMLViewer Control!

HTMLViewer with WebKit engine on Linux

HTMLViewer use default libgtkhtml library to render HTML on Linux… but there is a option to use WebKit. To do this simply install on your system libwebkit-1.0-1. If you like you can make a class that will install this library automatically.

Creating one line browser in REALbasic

To create a our web browser add to the Window HTMLViewer control. Set its LockLeft, LockTop, LockRight, and LockBottom properties so that it resizes as the user resizes the window. Now add a PushButton control and insert the code:

1
HTMLViewer1.LoadURL(http://tutspolis.com)

Opening link in new Window

If you like to have a option to open a link in new window add to HTMLViewer Function NewWindow() in code editor this code.

1
2
3
4
5
 Dim w as New Window1 //name of Window where is our HTMLViewer control
 
 Title = "new Window" //title property of new window
 w.Show //show the window
 Return w.HTMLViewer1 //render html

Page load progress in ProgresBar control

HTMLViewer can easy display the progress of page loading in ProgresBar control. You can make this using few lines of code in HTMLViewer Sub DocumentProgressChanged.

1
2
3
4
5
6
if percentageComplete = -1 then //if it cannot be determined
ProgressBar1.Maximum = 0 //display indeterminate progress
else
ProgressBar1.Maximum = 100
end if
ProgressBar1.Value = percentageComplete

Author: Jakub Pawlak

I'm interested in all. Currently working on the development of TUTSPOLIS and I hope that in near feature the project will be successful.

4 Responses to “HTMLViewer Control in REALbasic”

  1. matt86 says:

    Hi Jakub,
    How can I open a link (intoHtmlViewer) in a new window in my default browser?

  2. Jakub Pawlak says:

    Hi,

    If a new browser window is supposed to open, you need to insert some code to handle this event. For example, the user clicks a link that is supposed to display the new page in another window. Use the NewWindow event handler to create the window. The following code assumes that the browser is contained in a window called MainWindow.

    Dim w as New MainWindow
    Title = “new Window” //Title property of new window
    w.Show
    Return w.HTML

  3. matt86 says:

    Hi Jakub,
    you maybe don’t understand my question.
    In my Application when i click a link in my HtmlViewer the content of a target blank link must open in my default browser (Ex: Firefox).

    Example:

    In my HtmlViewer of my Applicatiom i have this link:

    mylink

    when i click in this link the content o this link will open into my default browser, such as Firefox, Safari, IE etc.

    Sorry for my bad english, but i’m italian.

  4. matt86 says:

    Help me please,

    On the window that has the html viewer i add a property
    openNewWindow as boolean

    In the NewWindow event of your HTMLViewer i put

    openNewWindow = true

    in the CancelLoad event i put

    if openNewWindow = true then
    showUrl url
    openNewWindow = false
    return true
    end if

    but not work, where i wrong?

Leave a Reply

Copyrights (c) TUTSPOLIS | Powered by Wordpress MU | Inspired at Elegant Themes designed by qbap (HTML5 & CSS3)