Switching in Windows

Visual LANSA Framework

Switching in Windows

The use of multiple windows reduces the need to use classic switching.

 

However, you can request that a window switch to some other task by using the avSwitch Method . You can control which window is switched by using the TargetWindow() parameter, which may be specified as MAIN, CURRENT or a specific window name. The default value for this parameter is MAIN.

 

There are some rules about window switching that you need to be aware of:

  • When a window is opened it has a scope.
  • A window's scope includes all the things that can ever be used inside it.
  • By limiting a windows scope the time taken to create it can be substantially reduced.  

 

For example if you open a FRAMEWORK window then every application, business object and every command defined in the Framework is within its scope.

 

However, if you open a BUSINESSOBJECT window, then only the business object specified and any related application or Framework level commands are in the window’s scope.

 

This means you cannot open a window named TEST, containing just business object A (say), and then later request that it switch to business object B. This is because business object B is not in window TEST’s scope.  

 

You cannot legitimately switch a window out of its scope. You can try to do this and may even get it to do some ‘interesting’ things, but this type of switching is not supported by the Framework. Using it may produce unpredictable results, either now or in future Framework versions.   

 

This also explains why the default value TargetWindow(MAIN) is used on the avSwitch method instead of TargetWindow(CURRENT).  The MAIN window has within its scope everything in the Framework, so the switch operation will always be valid, at least from the scope perspective.

 

Once you start to modify TargetWindow() parameters values you need to think about whether the switch will be within the target windows scope.