Adding Actions to Objects and Pages
Fortunately, you don't need to learn a sophisticated programming language, like Java or C++, to use VisualNEO Web's Actions. Although the syntax resembles a traditional programming language, it's significantly less complex and much easier to learn. In fact, most Actions can be inserted by selecting the desired command from a list and filling out an easy to understand questionnaire.
To view events associated with an object, double click the object with your mouse or click either Code or Split from the Mode Selector tabs at the top of your project's window.
The code view is where you will assign actions to objects to make them behave the way you want. The code view contains a tool bar at the top and a large editor window with tabs along the top and bottom. If the object you've selected has the ability to respond to multiple types of action events, the tabs along the bottom will contain the names of these events. If needed, you may specify a separate set of actions for each event by clicking the tabs. If more than one object is selected at the same time, the tabs along the top of the editor will contain the names of those objects. You can edit action events of the other objects by clicking these tabs.
Pages have events too. You can edit them by clicking the page background (from the design view) to select the page, then clicking the Code or Split tabs from the Mode Selector.
Action commands may be typed directly into the editor, but it's easier simply select them from the list to the right of the editor. The Action List contains all the commands supported by VisualNEO Web's NeoScript language - plus commands belonging to any third-party Plug-ins that have been installed. Actions are separated into categories. Clicking the icon next to the category name will display actions belonging to that category. A short description of each action will be displayed in a small window as your mouse pointer passes over it. To select an action and insert it into the editor, double click or drag the desired item from the list.
If the action you've selected requires additional information (such as a page title or a file name), a short questionnaire will appear, allowing you to provide the necessary details. These additional details are called parameters. For example, the GotoPage action requires a parameter that tells VisualNEO Web the title of the page you want to go to:
The questionnaire for the GotoPage Action lets you select from a list of pages by clicking the
arrow icon to the right of the edit box.
Once you've completed the questionnaire, VisualNEO Web will format and insert the action's code into the editor. Here is what the GotoPage action's code will look like when inserted into the editor:
You may insert additional actions by repeating the steps above. Multiple actions will be executed in the order that they are listed in the editor. Once inserted, you can edit actions manually using your keyboard or display the questionnaire again by double clicking the line containing the action’s code.
When actions appear in the editor, they must be formatted using a specific syntax in order to be understood by VisualNEO Web. When selecting actions from the Action List, this formatting is handled automatically. If you enter or edit actions manually, however, you will need to adhere to a few simple formatting rules.
The action’s name must appear first, followed by the required parameters, if any. Each parameter must be surrounded by either 'single' or double "quotes" and separated by spaces. For example:
AlertBox "Hello" "Greeting Earthlings." ""
AlertBox 'Hello' 'Greeting Earthlings.' ''
You can omit the quotes for parameters that don't contain spaces like variable names or numbers. For example:
SetVar [Message] "Hello Earthlings."
SetVar [Number] 400
Quotes should always be used for strings (text).
Each action and its parameters must fit on a single line in the editor. If more space is needed, the editor window can be scrolled horizontally to accommodate additional text. For actions that can display multiple lines of text (like AlertBox and MessageBox), line breaks must be marked within parameters using a special character called a pipe ( | ) and not by pressing the keyboard’s Return key.
For example, an action called AlertBox displays a basic dialog box with a custom message. AlertBox requires three parameters - the first is the dialog’s title, the second is message body and the third is an optional callback function (which we'll leave blank for now). The proper syntax for this command looks like this:
AlertBox "Greetings" "Welcome to my app!" ""
When executed, this action will display a dialog box like this:
Any lines appearing in the editor that begin with a period "." are ignored by VisualNEO Web. These are considered comments. For example:
.this is a comment
AlertBox "Greetings" "Welcome to my app!" ""
You can use this feature to add comments to your action scripts or to temporarily disable commands for debugging purposes.