Your first HB++ application

This section shows you how easy and fast it is to create your first HB++ application - through a simple Hello World sample.

Creating the user interface

Your first application will be made of a text field and a button. Clicking on the button will cause the message "hello world" to appear in the text field.

An HB++ application is made up of one or more forms as well as a class describing how the application will handle different launch codes. Don't worry about these: the "Minimal Project" wizard will do everything for you.

Wizard

Activate the frmMain default form which was automatically created for you:

Project window

Then, create a text field click using the appropriate tool in the toolbox:

Toolbox

Create a button... It is now possible to modify the properties of the button and the text field. Select the button, then in the property window, change the "Text" property to: "Hello". Now select the form, and define the "Caption" property as: "My First Application".

Properties

The design of your form is now complete. It should look like this:

Complete form

Writing code

Now, it is time to write the code handling the user events. Right clicking on a control displays the list of events it can raise. By right clicking on the button, you will see:

Events available for a button control

By clicking on the "Click()" item, the text

_Click() event

appears in the code edit window.

Enter the following code between the Sub and End Sub declarations:

Field1.Text = "hello, world"

That's all!

Compiling and debugging

Click the Compile button or press F5 to compile your project. The output window displays error messages and warnings.

Output window

In case your source code has no error, a .prc file is generated... You can install it on your handheld, or use the HB++ integrated debugger.

In case you want to use the HB++ integrated debugger, click on the Run icon to launch the application either in the Palm OS® Emulator or on a device connected through a serial cable. At any time you can interrupt the execution by clicking on the Pause button. Then, you enter in the debug mode in which it is possible to view the call stack or error messages generated by your application, add or remove a breakpoint by pressing the F9 key, inspect variables or resume the execution, possibly line by line.

Debugger 2

Debugger 3