Navigation:  How-To > Define Element's Behavior >

Example 1: Hello World Button

Previous pageReturn to chapter overviewNext page

Example 1: Hello World Button

Run This Example in New Window

Now let's create a simplest example: when click the button, popup a window to say "Hello World!".

First of all we need to drag a button element to the editing area, then double click it to change its text to "Click Me":

ex01_button

Then follow these steps:

1. Select the button and then open behavior editor for it.

2. Click the "Add Event" button in the bottom toolbar and choose the "Element Clicked" event.

3. Click the "Add Action" button in the bottom toolbar and choose the "Show Message" action.

4. Input the message "Hello World!" in the popup window, click "Ok" to finish.

After these steps, the behavior tree should looks like this:

element_behavior_sample1

Now let's run this simplest example, just click the run-sim button in the toolbar of main window, or launch the simulation from menu "Prototype->Run Simulation". You will see a browser window popped up with a button inside, clicking the button will bring up a message "Hello World!". You can view this online example to see the result.