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.
Redraw commands that are dealt with by this module:
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.
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'
Once the dataname of the single field to be redrawn has been determined, the command is converted to the equivalent Omnis Studio redraw command:
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'))
If this command is located in the $construct method of a window class, then it is removed.
If this command is located in the $construct method of a window class and it does not redraw all lists, then it is removed.
Change "Redraw {x}" commands where "x" is the field number to use the object name instead.