|
Conceptual Information
ConceptDraw Basic is a high-level scripting language. Starting from version 5.0 ConceptDraw introduces support for its proprietary built-in scripting language - ConceptDraw Basic. This adds the following advantages:
- Extends the functionality of ConceptDraw according to the needs of the users.
- Allows to process and visualize external data in ConceptDraw.
- Makes possible integration of third-party application with ConceptDraw.
- Enables a wide range of cross-platform solutions, based on ConceptDraw.
ConceptDraw Basic technology (unlike Automation on Windows, AppleScript on the Macintosh) is fully cross-platform , working in the ConceptDraw environment. The built-in scripting language realizes the specification of the modern high-level scripting language combined with support for ConceptDraw objects and database access objects. The supported list of ConceptDraw objects provides virtually unlimited control over documents, application windows, libraries, pages and shapes.
ConceptDraw Basic has the power and simplicity of modern realizations of the BASIC language. The language core of ConceptDraw Basic is almost fully compatible with such popular realizations of BASIC, such as Visual Basic, REALbasic.
With the introduction of ConceptDraw Basic technology СonceptDraw becomes one of the most powerful platforms for your custom visual solutions.
Application, Document, Page and Shape Level Scripts
ConceptDraw supports four execution levels of the ConceptDraw Basic scripting language: Application level, Document level, Page level, Shape level. This means that for any ConceptDraw document or it's page or any shape in the document you can assign a program written in ConceptDraw Basic. Also one can create a program on the entire application level. Any execution level contains at least a built-in module with program code in ConceptDraw Basic.

Execution levels of ConceptDraw Basic are organized in a hierarchy (see the figure below), which reflects how global variables and procedures are inherited from higher levels to the lower ones.
This means, that a script, created for any shape (on the shape level) also shows all global variables and procedures that belong to higher levels: Page, Document and Application. In its turn, a page-level script shows all global variables and procedures of the Document and Application levels. And finally, a document-level script shows global variables and procedures of the Application level. Thus, the hierarchy of execution levels determines the functional purpose of ConceptDraw Basic scripts at different levels.
Application levels script is intended for re-assigning the behavior of the entire application, and also for defining global variables and procedures, which may be often used in various documents. For instance, with the help of interface configuration and an application-level script in ConceptDraw Basic it's possible to turn ConceptDraw into a specialized application for computer network designers. One should just write the commonly used routines (for instance, calculation of the cost of the components) as application-level scripts and run them using the user-defined menu. Then the user will be able to automatically calculate the cost of the components for any network diagram.
Document level script is intended for document-specific calculations and also for defining global variables and procedures, used in the code of different pages or shapes of the document. For instance, a document-level script can be used to define specific procedures for creating templates. This may look like a wizard, that asks questions specific to a certain document type. Based on the user input, the script can determine the number and size of pages, create these pages and place necessary shapes on them.
Page level script is intended for calculations and actions, specific to a certain page of the document, as well as for defining global variables and procedures, used in the code of the shapes on that page. Scripts at this level may be used together with document-level scripts when creating templates. Creating graphic objects (shapes) is slightly easier at the page level, than at the document level.
Shape level script is intended for calculations, specific to certain graphic object (shape). For instance, it allows to program an element of a bar chart in such a way, that it can reflect values from a data base or an external file. Library shapes can also have scripts.
How Scripts Can Be Used to Create Wizards
Wizards, contained in some of the templates, supplied with ConceptDraw, represent a typical example of what ConceptDraw Basic scripts can be used for. Such wizards normally consist of one or more dialogs, which come up when you create a new document, based on the corresponding template.
Templates or documents, which have built-in wizards, include ConceptDraw Basic scripts at the level of the document, page or even shapes, located on the pages of the document, or in libraries, opened together with the template. Often the scripts are used to get data from the wizards into the ConceptDraw document. The wizards themselves are stored in external modules (dynamic libraries, or DLLs) on the Windows, or in shared libraries on the Macintosh. These libraries can be created in any environment (C, C++, Pascal, Objective C, etc.) which support building such libraries. The libraries contain a row of interface-procedures, called by the scripting program in ConceptDraw Basic, and finally gets the necessary data, which are integrated into ConceptDraw with the help of ConceptDraw Access Objects. For instance, when you create a new document based on the "Database Structure Wizard" template, a document-level script, built in the template is launched, which runs the "Reverse Engineering" wizard. This script calls a procedure from the CDWizards library, which represents a dialog, that asks the user the parameters for finding the database source and necessary parameters for extracting the database structure. Then the scripts asks the results of the wizard from the CDWizards library, gets the necessary information and uses it to base the database structures using the pre-drawn library shapes.
|