Module_FieldRedraws

Type: Module Parent Module: N/A

This module attempts to fix obsolete Omnis 7 field redraw commands. These are commands that redraw a particular field on a window rather than a complete window. If possible, the redraw is replaced with the equivalent Omnis Studio code to redraw the field. Also redraws that are found in window $construct methods that redraw the window being opened are removed, since they are redundant.

Functionality

Redraw commands that are dealt with by this module:

  1. Redraw named fields OBSOLETE COMMAND.
  2. Calculate X as Y (Redraw field).
  3. Do ...$redraw().
  4. Redraw lists.
  5. Redraw {x}.

Redraw named fields OBSOLETE COMMAND

Commands that redraw a single field are converted to "Redraw {x}", where "x" is the object name of the field to be redrawn.

If a commands redraws a range of fields (e.g. "Redraw named fields OBSOLETE COMMAND "), then an attempt is made to convert this to a Redraw command that incorporates all fields within the range, provided that the fields are located in a file class. The dataname of each field determined from the file class is converted to the name of the object on the window that displays the field.

An error is logged for any redraw command that cannot be converted, for example because it redraws a range of class variables.

Calculate X as Y (Redraw field)

The built-in converter does not convert redraw commands of this type, but places a comment following the Calculate command containing the message CONVERTER ERROR: Could not convert option(s) for calculate command: 'Redraw field'

Conversion to Omnis Studio type redraw command

Once the dataname of the single field to be redrawn has been determined, the command is converted to the equivalent Omnis Studio redraw command:

  1. Search list of field objects on the window (populated in oModuleSuper.$processClass) for a field that has a dataname that matches the object to be redrawn.
  2. If a match was not located then it may be the case that the developer added a redundant redraw option to a Calculate command used to implement a notational assignment. This is detemined by checking whether the rest of the command contains a "$" sign. If so then the converter comment is removed.
  3. If a match was found then the converter comment is replaced with a "Redraw {x}" command to redaw the relevant object by object name "x".
  4. If it is required to redraw a number of objects then this is done using a "Redraw {x,y,z}" command, where "x", "y" and "z" are the names of the field objects to be redrawn.

A list of objects redrawn within a code block ("If...", "Else If..." etc.) is maintained in order to attempt to remove any duplicate redraws of an object within the block. When code to redraw an object is placed in the method then the object is added to the list.

When a code block delimiter command ("If...", "Else If..." etc.) is encountered in the method being processed then the list of objects already redrawn is cleared.

If the old redraw command included the "All windows" option then the new command substituted will use $sendall to redraw all objects on all open windows that have a matching dataname, e.g.

Do $iwindows.$sendall($ref.$objs.$sendall($ref.$redraw(),$ref.$dataname='myDataName'))

Do ...$redraw()

If this command is located in the $construct method of a window class, then it is removed.

Redraw lists

If this command is located in the $construct method of a window class and it does not redraw all lists, then it is removed.

Redraw {x}

Change "Redraw {x}" commands where "x" is the field number to use the object name instead.

Assumptions

  1. Redraw commands reference objects within the window class being processed.

User Setup Required for this Module

  1. None.