|
Contents: Overview of the Script Editor Window Overview of the Script Editor Window
The Script Editor Window is where all script functions and variables are defined, modified or removed. These functions contain the client-side logic that is executed when certain user actions occur or when they are invoked by other client or host procedures. To open this window, select "View-->Script Editor" from the menu bar in the Design Window. You can also select a function in the "Available Functions" listbox in the design window and click the Edit button to both open the Script Editor and position the selected function in the text editor for editing in one step. A Function is a name assigned to a group of one or more script statements that include Client or Host methods. A function can contain any number of statements, of any type, in any desired order. You can think of a function as being similar to a subprocedure or subroutine. A function can be executed as a result of any of the following actions:
The objects referenced in a Client Method may be script variables, script objects, or special Jargon objects in the same app or in any other app that is open in the Script Editor Target Tree. This latter feature allows "myapp1" to get a value from a textfield in "myapp2" when a button is clicked in "myapp1", for example. Host Methods are run on both the client and the host.
Control statements in the scripting language provide looping constructs, conditional statements ("If/Then/Else") and similar ways to control execution sequence, as in any true programming language. The Insert menubar choices provide a quick way to enter such control statements in a script. Functions are executed when they are invoked within a client function
or host procedure, or when any of the event(s) to which they are linked
take place. Functions are linked to an event of an object by associating
them in the Events Panel of the
Properties Panel in the Design Window.
For a more comprehensive discussion of methods, objects, methods and events,
see the Overview of Functions, Methods and Events section.
The buttons in the Script Toolbar allow you to Open a new app in the Target Tree, Save the app whose script is currently being edited, Cut, Copy and Paste script statements in the editor textarea, and Return to the Design Window. The Cut, Copy and Paste buttons do the same actions as the corresponding Edit menubar choices. You can also use the standard Windows control key sequences in the script editor for Cut (CTRL-X), Copy (CTRL-C) and Paste (CTRL-V) operations. (However, note that these control keys cannot be used in the Design Window). The Edit App: combobox allows selection of the xml app whose script is to be edited. It does not have to be the same app that is currently selected in the Target Tree, although this is the default behavior when first opening the Script Editor Window from the Design Window. Use the Open button in the Script Toolbar to open any app that is not currently displayed in the Target Tree. The Target Tree is used to select an object in order to see its methods, and to find or insert those methods in the script. (The Target Tree is shared with the Design Window Component Tree; it is the same tree). The target object can be any object in the currently active app or in any other app that is open in the Target Tree, or any object in the Global Objects node. To select a target object, select or open the desired app, then expand the app's root node in the tree until the desired object is visible, then click on that object in the tree so that it is highlighted. Its available methods will then be displayed in the Method List below the tree. The list below the Target Tree (lower left) shows the available methods that are valid for the component that is currently highlighted in the Target Tree. This list has three columns. The first column shows the correct spelling of the method name (note that upper/lower case is significant) The second column shows the data type of the "Return Value" that is returned by the method when it is executed. Many methods return nothing ("void"), while others return one of the supported data types: String, int or boolean. A script method can return only one value. The third column contains the data type and descriptive parameter name of any required parameters. Supported data types are String, int and boolean. You must scroll the Method List to the right to see this column. All three column values are displayed in the status line at the bottom when you select the method. Finding component methods in the script.
Inserting component methods in the script.
The Text Editor Panel is where script functions and methods are entered and changed, by typing them manually, copying and pasting, or using the Insert choices from the menubar. Each xml app will normally have at least one function that contains a method that initially sets a frame visible when the app is first run. There may be any (reasonable) number of functions within an xml app, and each function may contain any number of methods and other statements such as variable definitions, looping and conditional statements, etc. A large app could easily have several thousand lines of script statements, grouped into hundreds of functions. For details on these methods, functions, and other scripting language features, see the Writing Scripts and Client Methods documents. For a more general introduction to objects, methods and functions, see the next section Functions, Methods and Events. The Edit Tools Panel above the Text Editor Panel contains textfields and buttons for standard search and replace features, with options to ignore case in searches and to replace the selected text or all occurrences of the selected text. It also allows a single undo level to revert the script to its state before the latest paste, replace or insert action (but not before manual changes to the script). The << and >> buttons shift the selected line(s) or portions of a line left or right one character position. This is useful to quickly indent or outdent text to show statement nesting levels and to follow typical coding standards. (The next person who works on a script will be a lot happier if it is easy to read. Plus, it could be you!). The "Go To Line" button positions the text editor window and insertion cursor at the script line specified in the Line# field. The "Jump to Function" combobox contains a list of the function names in the current script. Pull it down and select one to position the text editor window and insertion cursor at the first line of that function. The Status Panel at the bottom of the Script Editor Window contains a one-line message area at the lower left in which various Jargon Writer help messages are displayed during each step of working with methods. No input fields are used in the Status Panel. |
<-- Previous Section Up to Top Return to Help Index Next Section -->