User Tools

Site Tools


en:documentation:toolbox_editor

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:documentation:toolbox_editor [2014/06/14 12:10] – [Script editor] pchen:documentation:toolbox_editor [2016/01/12 09:32] (current) – [Create the tool layout] admin
Line 19: Line 19:
 Special elements are the Events. This not add anything visible on the screen but allow you to write the require script to process an event.\\ Special elements are the Events. This not add anything visible on the screen but allow you to write the require script to process an event.\\
 Event are : Event are :
-  * Initialisation: Run once after you click the Apply button, or when the program start.+  * Initialization: Run once after you click the Apply button, or when the program start.
   * Activation: Run every time this tool box is show.   * Activation: Run every time this tool box is show.
   * Timer: Run at periodic interval, enter the interval in second when you select this event.   * Timer: Run at periodic interval, enter the interval in second when you select this event.
Line 37: Line 37:
 If you select an element in the tree and change one of it's property the Update button appear to allow to apply the change. If you select an element in the tree and change one of it's property the Update button appear to allow to apply the change.
  
-A script can be attached to following elements: Button, Combo box, Event.\\  +A script can be attached to following elements: Button, Menu, Combo box, Event.\\  
-When you select one of this elements in the tree the "Edit script" button appear. See below for the details.+When you select one of this elements in the tree the "Edit script" button appear. See below for the details.\\ 
 +You can add a function to the right click menu of the chart. To do that create the function for a button and check "Menu".
  
 When you are ready click the Apply button to show your elements on the tool box and compile the scripts.\\ When you are ready click the Apply button to show your elements on the tool box and compile the scripts.\\
Line 48: Line 49:
  
 ===== Script editor ===== ===== Script editor =====
 +
 +The editor allow to write the script itself that execute on a button click, a combobox selection, or an event.
  
 {{:en:documentation:scripteditor.jpg?400|}} {{:en:documentation:scripteditor.jpg?400|}}
 +
 +The language to use is [[wp>Pascal_Script|Pascal Script]], based on [[wp>Object_Pascal|Object Pascal]].\\
 +Define first the global variables, then the procedure and function if any, then the private variable, and finally the main code start with **begin** and end with **end.**\\
 +Read the [[script_example|script example]] page for a quick start.
 +
 +As the each script is specific to one event there is no possibility to have global variables across scripts. For example you cannot set a variable when a button is pressed and later use this variable in another button click.\\
 +To solve this issue a number of global variables are predefined in the main program and specific functions allow to write and read them.
 +
 +This functions and other specific to the interface with Skychart, they are described in a separate [[script_reference|script reference]] page.
 +
 +Use the **Save** button to record your change and return to the main window.
 +
 +The top button are related to the debugging function as describe below.
  
 ===== Script debugger ===== ===== Script debugger =====
 +
 +Simple debugging function are available to test your code.
  
 {{:en:screenshot:x009_script_debug.jpg?400|}} {{:en:screenshot:x009_script_debug.jpg?400|}}
 +
 +To run the script in debug mode press the green arrow **Run** button. The program is first compiled.
 +
 +In case of compilation error, the corresponding row is highlighted in yellow, and the error message is show in the bottom message area. 
 +
 +If the compilation finish without error the program start to run and stop on the first code line of the main procedure. The current execution position is highlighted in blue.
 +
 +You can now use the **Step over** button to execute your program line by line.\\
 +The **Step into** button do the same, except if the current line is a call to one of your function. In this case **Step into** allow to run the function line by line, but **Step over** execute the function and stop at the main program next line.
 +
 +You can also set a breakpoint on a specific line to jump directly at this position.
 +
 +To set a breakpoint click on the leftmost column to show a red icon.\\
 +Use the Run button to jump to the next breakpoint. The current line is then highlighted in red.
 +
 +You can remove a breakpoint by clicking on the red icon or all at at time with the **Remove all breakpoint** button.
 +
 +You can display the value of variables when the program is in pause at a breakpoint or after a **Step over** click.\\
 +Just click on the variable name anywhere in the program source to display the value in the message area.\\
 +Note this work only for local variables, not for object properties.
 +
 +You can use the **Pause** button to pause the program execution. This can be useful to examine the condition of an infinite loop for example.
 +
 +The **Stop** button terminate the program execution immediately.
 + 
 +
 + 
  
  
  
en/documentation/toolbox_editor.1402740601.txt.gz · Last modified: 2015/11/06 20:34 (external edit)