Maximize MenuMinimize Menu

Back | Home

PocketC Architect Tutorial
Hello New World - Event Driven

In this tutorial you will create the classic Hello World program using PocketC Architect. This tutorial demonstrates the use of event driven programming in PocketC Architect.

// PocketC Architect Hello World
// Hello New World - event driven example

// app declaration
@app myApp {
creator = "HELN"; // creator id
name = "HelloWorld"; // display name
dbname = "HelloWorld-HELN"; // name of .prc database
}

// form declaration
@form myForm {
id = 1000
text = "Hello World"
x = 0, y = 0, w = 160, h = 160

button myButton {
id = 1001
x = 60, y = 80, w = 40, h = 12
text = "Hello"
}
}

// when the app starts, load the myForm form
handler myApp.onstart() {
myForm.load();
}

// when myButton is pressed, display Hello world
handler myButton.onselect() {
alert("Hello world");
}

 

1. Once you've downloaded and installed PocketC Architect start a new file and name it hello_new_world.oc. The whole project will be one simple .oc file and the .prc file compiled for Palm. Cut and paste the source code above.


2. Be sure the Palm Emulator is running and select Project | Build Project.


3. Check Generate standalone application and select Compile.

 

4. A standalone .prc file will be generated in the same directory as your source code file and be loaded onto the Palm Emulator.



©Copyright TrajectoryLabs.com. All Rights Reserved.