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.


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



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


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


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


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


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


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.