Home page
Articles for Windows, Linux, OS X
Mac tips and articles
Mac tips
Windows 8 tips and articles
Windows 7 tips and articles
Vista Tips
XP Tips
Linux tips and articles
Read the blog
Online store
Windows, Linux, OS X programs

Create your own web browser with Real Studio

Real Studio is an integrated development environment that enables you to create your own software. You don't need to be a programmer to start using it, but if you do have a little knowledge you'll get to grips with Real Studio even faster. In this article we will create a web browser in just a few simple steps to show just how easy it is to create software.

Start Real Studio and when it asks you to choose a template, select Desktop Application. (The next time you start it you might want to use the buttons at the bottom to open your last project to continue working on it.)

Real Studio will open and in the left panel is a list of controls (buttons, labels and so on), on the right are the properties (height, width and so on) of the current control, and in the middle is a blank window. That window is the your program.

The first thing you do is to design it and add some controls. In the left panel double click HTMLViewer, PushButton and TextField. Click and drag them into position and resize them so that they look like this:

Your button probably says Untitled instead of Go like mine. Click the button to select it, then click Caption in the right-hand panel and type Go. That's how you change the properties of controls. There are lots of them and you can even select the font to use on the button.

If you click the HTMLViewer control in the middle of the window and look in the properties pane on the right you will see that it is called HTMLViewer1. If you added another one it would be HTMLViewer2 and so on. Controls can be renamed, but let's leave it as it is.

Double click the Go button in your program and the code window will open. You'll see that PushButton1 Action is selected in the left panel. The Action is what happens when the button is clicked. Type HTMLViewer1.LoadURL(TextField1.Text).

OK, time to try your web browser. Click the Run button in the toolbar and your program runs. Enter www.google.co.uk into the top (address) box and then click the Go button. Google's home page appears! You now have a basic web browser working.

One flaw it has is that if you resize the window, the web page contents in the HTMLViewer control doesn't get resized. We need to fix this. Stop the program by clicking the quit button and then double click any part of the window (an empty part with no controls). The code window selects the Open event in the Event Handlers list in the left panel. This isn't what we want, but it's close. Select Resized just below it and enter this:

This might look complicated, but basically it gets the window width and height, allows a bit for the border, and then sets the width and height of the HTMLViewer1 control.

There's another irritation. When you enter a website URL into the address box (TextField1) at the top of the window, you'll probably hit Enter rather than reaching for the mouse and clicking Go. We need to add this to the program. Double click the TextField1 box in the window, select KeyUp in the left pane, and then enter this:

The KeyUp event is triggered when you press and release a key. The Enter key has the Ascii code 13, so we check for Asc(Key) being equal to 13 and if so, push the button with PushButton1.Push, it's quite straightforward.

Compile it into a program
At the moment, the program only runs within Real Studio, but if you click the Build button in the toolbar it will be turned into a stand-alone program. You can give this away, sell it, and run it on any computer - Real Studio is not needed.

With Real Studio Professional you can choose whether you want your program to run on Windows, Apple Mac OS X or Linux. So you can create the program and test it in Windows, for example, then compile it to a program that runs on the Apple Mac or Linux. You can compile it for all three if you want. With the Personal edition, your program is compiled for whatever system it is running on. Compile it on a Mac for a Mac program, Windows for a Windows program, Linux for a Linux program. Only Pro lets you run it on one OS and compile for another one.

Add more features
Of course, this home brewed browser won't make people switch from Chrome, Firefox or whatever they are using. We spent only 10 minutes creating it! The point of the exercise is to show how easy it is to create functional programs with very little effort. How many lines of code are in this program? Four?

If you want to continue with this, you can add forward and back buttons, bookmarks and more. It's up to you what you put in it and that's the advantage of writing your own software. It does exactly what you want.

Real Studio is available for:

  • Windows XP, Vista and 7
  • Ubuntu, Red Hat and other Linux distros
  • Apple Mac OS X Leopard, Snow Leopard and Lion

Real Basic versions:

  • Personal: Aimed at hobbyists and students
  • Professional: For part time developers and more serious programmers
  • Enterprise: Designed for full time programmers
  • Web: For all developers creating web apps