The Code View tab in the right pane of the Script Editor, shown in the figure below, provides a text editor where you can manually edit the code for all code modules and forms. When you are designing a form in the Design View tab, the Script Editor automatically inserts properly formatted, color-coded, and commented text in the Code View tab. A number of features noted in the Code View tab example below help you to write and debug code.
Code View Tab of the Script Editor
The toolbar in the Code View tab of the Script Editor, shown in the figure below, enables you to create and edit script modules.
Code View Toolbar
Code View Toolbar Buttons
Cut: Moves one or more selected objects to the Windows clipboard, removing them from the work area. Cutting data/objects to the clipboard replaces the contents previously stored there. |
|
Copy: Copies selected objects to the clipboard. Copying data to the clipboard replaces the contents previously stored there. |
|
Paste: Places a copy of the objects currently in the clipboard into the work area. The objects remain on the clipboard until you copy or cut another object to the clipboard. Use this command to insert a copy of the clipboard contents at the insertion point. |
|
Delete: Deletes the selected objects from the work area. |
|
Undo: Reverses the last editing action. |
|
Redo: Restores the last editing action that was undone. |
|
Find: Opens the Find dialog box. Enter a string to search for in the Find What field. |
|
Replace: The Replace operation works in a similar way and replaces the Find What string(s) with the Replace With string(s). All dialog options are the same, except that the Replace dialog box has a field called Replace With. |
|
Debug Message: Click to insert a message (that is, a MessageBox.Show() line) for debugging at the place where the cursor is resting. The Insert Debug Message dialog box opens so create a message that includes any local variables, where appropriate. |
|
Check for Errors: Click to check the code for syntax errors. Errors are explained in the status bar at the bottom of the tab. |
|
Intellisense: Enables or disables the Intellisense feature for code editing. Intellisense is an auto-completion tool that simplifies script writing. |
|
View API Help: Click to open the GENESIS64 API online Reference Guide. Note that the online reference has some helpful interactive features that let you expand and collapse sections, quickly move from one section to another, and even send feedback to ICONICS. You can also press the F1 key to open API help. |
In the Code View tab, right-clicking in the work area opens a shortcut menu, as shown in the figure below, providing you with convenient menu commands for editing code.
Code View Shortcut Menu
Code View Shortcut Menu Commands
Command |
Shortcut Keys |
Function |
Undo |
CTRL+Z |
Reverses the last editing action. |
Redo |
CTRL+Y |
Restores the last editing action that was undone. |
Cut |
CTRL+X |
Moves selected text to the Windows clipboard, removing the text from the work area. Cutting text to the clipboard replaces the contents previously stored there. |
Copy |
CTRL+C |
Copies selected text to the clipboard. This command is unavailable if no text is currently selected. Copying data to the clipboard replaces the contents previously stored there. |
Paste |
CTRL+V |
Places a copy of the data currently in the clipboard into the work area. The data remain on the clipboard until you copy or cut new data to the clipboard. Use this command to insert a copy of the clipboard contents at the insertion point. This command is unavailable if the clipboard is empty. |
Delete |
Delete |
Deletes the selected text from the work area. |
Select All |
CTRL+A |
Highlights all text in the work area. |
Find |
CTRL+F |
Opens the Find dialog box. Enter a string to search for in the Find What field. |
Find Next |
F3 |
Searches for the next match of the string specified in the Find What field. |
Replace |
CTRL+H |
The Replace operation works in a similar way and replaces the Find What string(s) with the Replace With string(s). All dialog options are the same, except that the Replace dialog box has a field called Replace With. |
The Code View tab in the Script Editor features Intellisense, which is an auto-completion tool that simplifies script writing. To enable or disable the Intellisense feature, click the Intellisense button on the Code View toolbar. When Intellisense is enabled, the auto-completion tool will give you suggestions "on the fly" as you write your scripts. Intellisense helps you use the proper syntax for enumerations, properties, methods, and other code items, helping to reduce errors in your code. When you select an item from the drop-down list, the item is inserted into the code.
For example, you may want to show a Message Box, but forgot the correct functions to apply. Using IntelliSense, you can browse through the available objects, properties, and methods, taking advantage of the AutoComplete feature, as well as visualizing a description of the highlighted item, MessageBox in this example. However, keep in mind that IntelliSense is just a tool to help make scripting easier. If it does not show you what you need to know to use a function, you should refer to the interactive online GENESIS64 API Reference Guide, which you can access by clicking the Help button in the Code View toolbar.
The Script Editor also provides ToolTips and help text for items in the code. When you select an item using Intellisense, the ToolTip for that item describes the item type (e.g. class or enumeration) and provides a description of the item. To view the ToolTip for an item in the code, simply hover the mouse pointer over the item.
See also:
Scripts that Manipulate Objects at Runtime
Scripts that Use a Form or Dialog Box