Module_CallMethod

Type: Module Parent Module: N/A

This module fixes any calls to methods that use the method number and can convert calls to menu and window methods that use the command "Call method OBSOLETE COMMAND" to an appropriate OMNIS Studio method call (i.e. Do, Do method, Do code method).

Functionality

If a "Call method OBSOLETE COMMAND" is encountered that references a method using its Omnis 7 style method number then substitute the name of the method using information saved in the file "fProcs" by the Omnis 7 Analyzer.

For example: Call method OBSOLETE COMMAND M_Shared_Code/42 (x,y)
is converted to: Call method OBSOLETE COMMAND M_Shared_Code/Edit_Record (x,y)

Conversion of classes to Code or instatiated classes

Before running the Converter the developer must first select which window and menu classes are to be converted to code or instantiated calls. See User Setup Required for this Module below for instructions on how to do this.

The class status "code" indicates that the class is to be converted to a code class. All methods within the class are copied to a new code class and any calls to the methods are converted to use the "Do code method..." command.

The class status "instantiated" indicates that the class will be instantiated at run-time. All methods within the class are converted to public methods (prefixed by a "$" sign) and any calls to the methods are converted to use a message based call using the "Do...." command and appropriate notation for the public method.

  1. In the case of menus, instantiated means that they will be installed on the OMNIS menu bar (i.e. always available via the group $imenus) by the application. Calls to the methods of these menus will be converted to use the notation Do $imenus.myMenu.$myMethod.
  2. In the case of windows, instantiated means that they will be open (i.e. always available via the group $iwindows). Calls to the methods of these windows will be converted to use the notation Do $iwindows.myWindow.$myMethod.

Note that it is the developer's responsibility to ensure that any menu which is included in this list is installed on the menu bar when calls are made to its methods. The same applies for any windows which must have a single open instance. If these instances do not exist at the time when a call is made then the method call will fail and unless an error handler is active this failure is likely to be unreported.

When a call to a method of a menu or window is located and the status of the class is "instantiated" then the method name is checked to see if it is public, if not it is changed so that it is prefixed with a $ sign (made public) and the call is converted to use the Do command. Only one instance of the class is permitted and the instance name is assumed to be the same as the class name. Adding the $ sign will obviously have a knock-on effect for any other references to the method name in the application (e.g. Do method xyz). This is resolved by writing records to the "O7A_xxx.df1" datafile created by the Omnis 7 Analyzer library, and using the module "ModuleyMethodNames" to fix the references.

For example: Call method OBSOLETE COMMAND M_Shared_Code/Edit_Record (x,y)
is converted to: Do $imenus.M_Shared_Code.$Edit_Record (x,y)

When a call to a method of a menu or window is located and the status of the class is "code" then the class is converted to a code class by copying all methods across to the new code class and then all calls to the object's methods are converted from Call method OBSOLETE COMMAND to Do code method.

The new call will use the name of the method

For example: Call method OBSOLETE COMMAND M_Shared_Code/Edit_Record (x,y)
is converted to: Do code method M_Shared_Code.Edit_Record (x,y)

When copying a menu class to a code class:

  1. Copy the "$construct" method if its exists, but also display a warning in the log, since this method will not execute in a code class.
  2. Do not copy "Line 1","Line 2","Line 3","Line 5","Line 6" if they contain no code lines.

Assumptions

  1. None.

User Setup Required for this Module

Before running the Converter the developer must first select which window and menu classes are to be converted to code or instantiated calls. To do this:

  1. Select the Convert... option from the O$Converter main menu.
  2. Select required library from the list on the Select Library to be Converted window.
  3. Select Module_CallMethod from the Modules menu on the Select Library to be Converted window.
  4. Using the drop down lists on the grid select the classes to be converted to code classes or instantiated to be called via Do command