FriendUP HQ

Please visit the main source of project information on the FriendUP website:

Tutorial 1 – how to write a simple app

This is the first tutorial in a series that we will post that will show you how to program your own applications in Friend. We will assume you have access to the Friend beta server and have familiarized yourself with Friend Create in order to follow this tutorial. As an option, you may read and complete the tutorial found on the Website DOS driver in the Friend Developer’s Manual and use that approach when following these tutorials.

Getting started.

When writing a Friend application in the Friend Workspace, you should first create a project directory. You can do that by opening up Friend Shell and typing in:

System:> makedir Home:Projects/

This will create your Projects/ directory for you. You can now open Friend Create and start editing your application.

We need to have two empty documents to complete this tutorial. Save the first document as tutorial1.jsx. Save the other as tutorial1_template.html. Once you have done this, type this in your .jsx file:

Application.run = function( msg )
{
    var f = new File( "Progdir:tutorial1_template.html" );
    f.onLoad = function( data )
    {
        var v = new View( { title: "Tutorial 1", width: 500, height: 500 } );
        v.setContent( data );
        v.onClose = function(){ Application.quit(); }
    }
    f.load();
}

In the .html file, you type in this:

<div class="ContentFull Padding ScrollArea">
    <p>Hello world!</p>
    <p><button type="button" onclick="Application.quit()">Goodbye world!</button></p>
</div>

Once you have saved both documents, you can go to your Home:Projects/ directory by double clicking on the Home: disk. Then you will find your two icons here. Double click the tutorial1.jsx executable and you will see your program!

Hope you have enjoyed this tutorial. Now let’s plan the next one.

Leave a Reply