org.symbian.tools.wrttools.doc.WRTKit/html/WRTKit_Hello_World_Tutorial-GUID-67e0a561-48ac-4938-8f1b-852422b71380.html
author Eugene Ostroukhov <eugeneo@symbian.org>
Thu, 11 Mar 2010 18:00:58 -0800
changeset 261 a691cdb6c78a
parent 230 7848c135d915
permissions -rw-r--r--
Bugs 2170 and 2046
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
230
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     1
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     2
<html lang="en" xml:lang="en">
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     3
<head>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     4
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     5
<meta name="copyright" content="(C) Copyright 2005" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     6
<meta name="DC.rights.owner" content="(C) Copyright 2005" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     7
<meta content="concept" name="DC.Type" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     8
<meta name="DC.Title" content="Hello World" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     9
<meta scheme="URI" name="DC.Relation" content="WRTKit_Tutorials-GUID-506c11e3-e6f3-43ec-9495-fcfa638b7e08.html" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    10
<meta scheme="URI" name="DC.Relation" content="WRTKit_Creating_the_Hello_World_widget-GUID-d638159a-d12b-476c-a74c-99055672b7be.html" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    11
<meta content="XHTML" name="DC.Format" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    12
<meta content="GUID-67E0A561-48AC-4938-8F1B-852422B71380" name="DC.Identifier" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    13
<meta content="en" name="DC.Language" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    14
<link href="commonltr.css" type="text/css" rel="stylesheet" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    15
<title>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    16
Hello World</title>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    17
</head>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    18
<body id="GUID-67E0A561-48AC-4938-8F1B-852422B71380"><a name="GUID-67E0A561-48AC-4938-8F1B-852422B71380"><!-- --></a>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    19
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    20
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    21
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    22
    <h1 class="topictitle1">
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    23
Hello World</h1>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    24
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    25
    <div>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    26
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    27
        <p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    28
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    29
            Whenever you are learning a new programming language or API, the first example
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    30
            you will find is usually called "Hello World" and the WRTKit is no exception.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    31
            Like most "Hello World" applications this one will be very simple and short, but
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    32
            before we start we'll take a look at what we will need to build the example.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    33
        </p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    34
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    35
        <p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    36
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    37
            The WRTKit already contains all the files that will be created in this tutorial.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    38
            If you go to the "Examples" directory in the WRTKit SDK you will find a directory 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    39
            called "HelloWorld". This directory contains all the files necessary for the widget
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    40
            and all you have to do to try it out on a handset or S60 emulator is to zip up the
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    41
            directory, rename the file to "HelloWorld.wgz" and follow the usual steps to install
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    42
            a widget on the handset or emulator.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    43
        </p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    44
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    45
        <p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    46
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    47
            The WRTKit Hello World widget is very similar to any other S60 Web Runtime widget.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    48
            You have an Info.plist file that defines the metadata for the widget, such as its
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    49
            name, version and main HTML file and you have the icon of the widget in a file called
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    50
            Icon.png. The main HTML file for the Hello World widget is called "HelloWorld.html".
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    51
            But it's here that things start to get a little bit different because we're using
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    52
            the WRTKit to create our user interface.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    53
        </p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    54
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    55
        <p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    56
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    57
            If we didn't use the WRTKit then the HelloWorld.html file would probably contain
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    58
            the text "Hello World" between the &lt;body&gt; and &lt;/body&gt; tags, and that
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    59
            would be it. But when you use the WRTKit you create your user interface using
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    60
            JavaScript rather than HTML. This might sound scary and difficult at first but it
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    61
            actually saves you a lot of typing and gives you a lot of things for free that
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    62
            you would otherwise have to take care of yourself. Our Hello World widget will be
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    63
            quite a bit fancier than one created with just HTML and it will still be very
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    64
            short and simple.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    65
        </p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    66
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    67
        <p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    68
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    69
            The directory also contains a HelloWorld.js file and a WRTKit directory but we
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    70
            will not talk about those quite yet.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    71
        </p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    72
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    73
        <p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    74
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    75
            Even though we have already created all the files for you, you might want to
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    76
            type in the code yourself. Either way you will need a text editor. Any text editor
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    77
            will do really but it will make your life considerably easier if you have one that
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    78
            is specialized for programming and offers syntax highlighting for HTML, CSS
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    79
            and JavaScript.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    80
        </p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    81
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    82
        <p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    83
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    84
            Finally, you will need a handset or emulator that includes the S60 Web Runtime.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    85
            You can actually work with the WRTKit even without the S60 Web Runtime because
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    86
            the WRTKit works in a normal standards-compliant web browser such as Firefox.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    87
            But since a PC computer and web browser is quite different from a mobile device
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    88
            it is still recommended that you test your widget on actual devices in order
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    89
            to get a feel for what the widget will actually look and feel like. For quick
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    90
            tests in a PC web browser though, all you have to do is open up the main HTML file
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    91
            in the browser and things should work without any changes to the code.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    92
        </p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    93
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    94
        <p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    95
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    96
            No other tools or libraries are needed and you're now set to start working on
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    97
            the Hello World widget.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    98
        </p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    99
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   100
    </div>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   101
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   102
<div>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   103
<ul class="ullinks">
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   104
<li class="ulchildlink"><strong><a href="WRTKit_Creating_the_Hello_World_widget-GUID-d638159a-d12b-476c-a74c-99055672b7be.html">Creating the Hello World widget</a></strong><br />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   105
</li>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   106
</ul>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   107
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   108
<div class="familylinks">
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   109
<div class="parentlink"><strong>Parent topic:</strong> <a href="WRTKit_Tutorials-GUID-506c11e3-e6f3-43ec-9495-fcfa638b7e08.html">WRTKit Tutorials</a></div>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   110
</div>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   111
</div>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   112
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   113
</body>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   114
</html>