Navigation:  Examples >

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 clicking the button, popup a window to say "Hello World!".

First of all we need to drag a button element to the editing area.

drag_button_to_editor

Then double click the button to change its text to "Click Me", then click the "Ok" button to finish editing.

change_button_title

 

Press Ctrl+D (Command+D in Mac OS) to open behavior editor and define behavior for the button.

define_behavior_for_button

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

add_event_for_button

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

add_action_to_button

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

hello_world

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

behavior_for_hello_world

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, or download the plot file.