Objects

Prior | Next

Objects are very important in programming.  Objects are structured data types that contain fields that hold values. Objects, however, also contain methods.  Methods are procedures and functions that act on the data in the object's fields.

Each time you click on a button in Ensign Windows, you are calling the button object's click method to perform a specific task.  Each button, menu item, window, chart, study and draw tool in Ensign Windows is an object.

Many of the objects in Ensign Windows can be controlled by ESPL, which exposes tremendous power to ESPL scripts. Example:

begin
  chart( 'SP0Z.D' );
  btnPrint.click;
end;

The chart statement is a predefined function in the ESPL library.  While this statement is simple to use and understand, it required more than 3,000 lines of code to implement the chart object.  The chart object creates a Multiple Document Interface child window, loads a data file, updates the file with data from the tick pool, determines the scale, draws the chart, scale and grid, and applies other objects such as studies and draw tools.

Button Objects Exposed
The buttons on the Ensign Windows Main Button panel can be accessed in the ESPL script.  Properties can be read and set.  Please refer to the Help documentation for Ensign Windows Buttons for a list of the properties and the button names. Call the Click method to execute the button as if the button had been clicked on with the mouse.  All button names begin with the btn prefix.

btnPrint is the name of the Print button object. Click is the name of its method. The btnPrint.click; statement calls the click method for this object which is the same method called by clicking on the Print button with the mouse.  This method transfers the image of the current window, the chart, to the printer.  The printing of a chart required more than 500 lines of code to implement.

Menu Objects Exposed
The menus on the Ensign Windows Main Menu can be accessed in the ESPL script. Call the Click method to execute the menu item as if the menu item had been clicked on with the mouse.  The menu names are similar to the wording found on the menu item, and are listed in the Help documentation for Ensign Windows Menus.  All menu names begin with the mnu prefix. For example, mnuCloseWindow.click; is used to close the active window.  Example:

begin
  mnuQuotes.click;
  mnuPrintWindow.click;
  mnuCloseWindow.click;
end;

Prior | Next