Submodule_Methods_OpenWind

Type: Submodule Parent Module: ModuleCMethods

The Open window instance command behaves differently to the Omnis 7 Open window command. Whereas the old Open window command opened a single instance of a window or, if the window was already open caused it to come to top, the Omnis Studio command Open window instance will attempt to open a new instance of a window class each time it is executed. Since the converted command uses the class name to name the instance this will cause a run-time error in Omnis Studio if the command is executed twice without closing the first instance. This sub-module resolves this by converting the Open window instance command to a command which only open a single instance of the window class.

Functionality

Search for commands containing "Open window instance".

The Open window instance command is checked to determine whether it positions the open window using the parameters Top, Left, Height or Width. If so then the code is modified as follows:

  1. A "Test for window open" command is added to preceed the Open window instance command to determine if the class is already instantiated.
  2. If it is not instantiated, then the original Open window instance command is retained unaltered.
  3. If it is instantiated, then the command "Do $iwindows.className.$bringtofront()" is used to bring the instance to top.

If the original Open window instance command does not use the parameters Top, Left, Height or Width then the code is modified as follows:

  1. Replace the original Open window instance command with the command "Do ....$openonce()" to open a single instance of the window, or bring it to top if already open.
  2. Note that this method does not accept positioning parameters so cannot be used in place of the code above.

In this way only a single instance of each window class is opened.

Assumptions

  1. None.

User Setup Required for this Module

  1. None.