Ide/Code Experts

Visual Prolog IDE contains several Code Experts:


 * The feature, which generates all the default code, resources, and make-scripts for an application. It also handles modifications of project settings.
 * The is used for searching of Visual Prolog names used in the edited project. This searching is accomplished in all files registered in this project.
 * The simplifies inserting of standard Visual Prolog program elements into the editing source code.
 * The is a nearly deprecated tool, which is today only used to control menu bindings for the Task Window in an MDI application.  In a project that contains old migrated resources it can also play a role for these.

Source Browser


The main aim of this tool is multi-file searching for Visual Prolog names used in the project. Displayed in the Source Browser dialog information is gathered by the compiler while compiling of the project files. Therefore, to update the "browse"information about any modifications in source files you need to recompile these files (Build menu commands can be used).

Options
Search for:
 * Here you enter a string to search for. The search string can be specified by selecting a substring in the text editor before calling the Source Browser dialog. The selected text will appear in the Search for box.
 * The Source Browser will search for the specified substring in any place of names (not only in the beginning). It will display all names containing this substring.

Search in:
 * Selection in this group of check and radio buttons determines types of user defined names that will be displayed in main pane of the Source Browser dialog. Here you can select:


 * All
 * If you check ON the All check box, the Source Browser dialog will search the specified substring among all program items. In this case, any other check boxes will be disabled.


 * The program item types you can specify in this group box are:
 * Predicates
 * Specifies to search among predicates.
 * Properties
 * Specifies to search among properties.
 * Facts
 * Specifies to search among facts.
 * Domains
 * Specifies to search among domains.
 * Constants
 * Specifies to search among constants.
 * Classes
 * Specifies to search among class names.
 * Interfaces
 * Specifies to search among interface names.

Use Regular Expressions
 * See for details.

Search Results
The central pane of the Source Browser dialog displays Visual Prolog names, which are found in the project.

Type in some string into the Search for box and press Enter to activate the search operation.

After the search will be accomplished the central pane of the Source Browser dialog will display the tree of classes, interfaces, and class implementations in which the Search has found program items (of selected types) with names containing the specified substring. All items are prefixed with the same , which are used in the Project window. Clicking plus  icons before a class/interface/implementation you can unfold it and see names, which are found in it.

Double-click any name will open the correspondent file in the text editor and jumps to this name.

When in the central pane of the dialog, the right mouse button will open the pop-up menu containing 2 commands:


 * Go to Declaration
 * This command jumps to the declaration of the selected name.
 * Go to Definition
 * This command jumps to the definition of the selected name.

Code Expert
The Code Expert is a nearly deprecated tool, which is today only used to control menu bindings for the Task Window in an MDI application. In a project that contains old migrated resources it can also play a role for these.

"Modern" dialogs, forms and custom controls are handled by the.

You can activate the Code Expert when the focus is in the IDE Designer by selecting the Code Expert command in the mouse pop-up menu (or in the View menu, or alternatively by clicking the Ctrl+Shift+W hot key). Also you can activate the Code Expert when the focus is in the Project window and one of dialog or window type resource files is selected. Otherwise, the Code Expert command is disabled or the IDE displays the warning that the selected file is not associated with a dialog, window, form, or IDE control.

The name of the selected dialog or window file is displayed in the Code Expert title. On the picture below it is TaskWindow.



In the upper line of the Code Expert you see 3 radio buttons: All, Handled and Unhandled. Selecting among them you can specify which type of events will be displayed in the central pane:

All
 * All events coming to the dialog or the window are displayed.

Handled
 * Only events that are caught (Handled) by the correspondent listener or responder are displayed.

Unhandled
 * Only events that are not caught (Unhandled) by the correspondent listener or responder are displayed.

In the central pane of the Code Expert dialog you see the tree of events that come to this dialog or form. Notice that the event tree displays all possible events that can come to a dialog or a form. So for some dialogs/windows the event tree can display some extra events that never come to these dialogs/forms. For example, if a dialog does not have scroll bars, its listener never receives HScroll and VScroll, but you can see these events in the event tree.

Handled events are marked with, and names of handler predicates are displayed after event names. Unhandled events are marked with.

Notice that the code for the predicate generatedInitialize is 100% automatically maintained by the Code Expert. You MUST NOT make any manual correction of this predicate since any your corrections will be overwritten while the resource compilation. You can also see this code is surrounded with special comments do not update it manually

In the central pane you can see the following groups of events:


 * Window
 * These are the events that came to the dialog/window as a whole entity.
 * Menu
 * This group of events exist only for forms. These are the events that came to the form from the menu.
 * Scroll Bar
 * These are the events that came to the dialog/form from the dialog/form scroll bars. Notice that these are not events from the scroll bar controls that you place inside dialogs/forms (events from the scroll bar controls you can see in the Control group of events).
 * Control
 * These are the events that came to the dialog/form from controls placed in the dialog/form.
 * Key
 * This group of events exist only for windows. These are the keyboard events.
 * '''Mouse
 * These are the events that came to the dialog/form from the mouse.
 * Miscellaneous
 * These are the miscellaneous events that do not fit to any of the previous types. They are timer, end session events and etc.

The Window, Menu, Scroll Bar, Control, Key, Mouse and Miscellaneous nodes in the events tree can be preceded with the or  icons. Pressing on these icons expands or collapses the correspondent node.

In the bottom of the Code Expert there are 2 buttons Add / Delete and Set:

Add / Delete
 * When an event selected in the event tree is Unhandled, this button has the caption Add. By pressing this button, you can add Â the clause handling this event into the dialog/form. In addition, the default declaration and definition for the event handling predicate are generated. When the selected event is Handled, then this button has the caption Delete. Pressing the Delete button, you can delete the clause handling this event from the dialog/form.

Set
 * This button is enabled only when the selected event is Handled. Using the Set button, you can change the name of the event handling predicate. The clause for the new listener will be generated appropriately. However, the Code Expert will not delete/change code for the previously used listener. Notice that when the selected event is Unhandled, the Set button is disabled, but in spite of this, you can type in the desired name of listener into the edit control. This name will be used instead of the default name when you press the Add button.

There are some advantages and some disadvantages to using the Code Expert. The main disadvantage is that the code experts insert some extra comments, which used to locate the source code at a later time. However the advantages are:


 * 1) It saves a lot of typing.
 * 2) It gives a standardized way of handling things, which other Prolog programmers will know.
 * 3) You know your application from the user interface; then by using the code experts, you can easily come to the source code through selection of the user interface component.

The Code Expert can automatically update the source code, when the layout or attributes of a user interface component are modified. This automatic updating is always done only inside comment brackets marked by: % This code is maintained by the IDE. Do not update it manually ....% Some code handled by the Code Expert % end of automatic code