VFW122 – Launching a VLF Window
Programatically Creating and Managing Windows
Your programs can create and manage windows by calling the method avShowWindow in the Framework manager.
For example:
- Open a whole new instance of the Framework in another window named MYWINDOW:
#AvFrameworkManager.avShowWindow Caller(#Com_Owner) For(FRAMEWORK) WindowName(MYWINDOW)
- Open the DEMONSTRATION application:
#AvFrameworkManager.avShowWindow Caller(#Com_Owner) For(APPLICATION) ofType(DEMO) WindowName(DEMO_WINDOW)
- Open an application view named HR:
#AvFrameworkManager.avShowWindow Caller(#Com_Owner) For(VIEW) ofType(HR) WindowName(DEMO_VIEW)
- Open business objects Organizations and Resources in two independent windows:
#AvFrameworkManager.avShowWindow Caller(#Com_Owner) For(BUSINESSOBJECT) ofType(DEM_ORG) WindowName(DEMO_EMP)
#AvFrameworkManager.avShowWindow Caller(#Com_Owner) For(BUSINESSOBJECT)
ofType(DEM_ORG_SEC_EMP) WindowName(DEMO_SECTION)
Remember that the
names you specify on calls to are the values specified on the tab of the properties of the respective object:
Using the avShowWindow method
When the
method is invoked, it tests whether a window with the name specified exists.If the named window already exists, it is activated (ie: restored from being minimized, if required, and brought to the front of all the Framework windows).
If the named window does not exist, it is created.
Then in both cases:
- The window's open information properties and object reference are updated with anything you supplied (see in the .).
- A switch operation is performed inside the window to any application or business you may have nominated.
In simple terms, you are saying to the Framework
.When you create a new window or switch an existing window it happens asynchronously to your program. So if you use
and then immediately enumerate all open windows you will not find the window you just created (yet).The uShowWindowCompleted Method
This method should be placed in a command handler which needs to "wake up" and perform some processing when requested by a command handler in the main VLF window:
For example a command handler in a window named EMP_WINDOW contains:
Mthroutine Name(uShowWindowCompleted) Options(*Redefine)
#EMPNO := #Com_Owner.avCurrentWindow.OpenInfo<1>
Fetch Fields(#XG_HEAD) From_File(PSLMST) With_Key(#EMPNO)
Endroutine
The method
is run when another command handler performs:#AvFrameworkManager.avShowWindow WindowName(EMP_WINDOW)
The methods
and should be considered as a "pair".Window Names
You may have noticed from the preceding examples that windows have symbolic names. Here are some things you should know about window names:
- The names ALL, MAIN and CURRENT are reserved.
- When an end-user opens a window it is automatically assigned a unique name that starts with USER_. Do not rely on USER_ window names being the same from Framework signon to signon or from Framework version to version.
- Names are not end-user visible. They are programmatic names, case insensitive and may be up to 256 characters long. Being case insensitive means they are often uppercased, so using just 'A' -> 'Z' and '0' -> '9' is advisable.
- Window names are uniquely scoped and only addressable within a Framework process (ie: a LANSA X_RUN.EXE process). This means that if you start multiple X_RUN.EXE processes they can each contain a unique window named TESTWINDOW. An operation that involves signalling or switching window TESTWINDOW only refers to it within the current X_RUN.EXE process. No intra-process windows operations are currently provided.
Application Settings
The Properties for a Framework, an Application and a Business Object enable the designer to determine whether each object can be opened in a new window,
or :
Note: The setting will always open the object in a new window when it is selected in the panel. It therefore means .
The setting applies to that level only. So a setting of
at the Framework level, means the whole framework cannot be opened in a new window, but an application or business object can be opened in a new window, if this is allowed for the object.Objective
To extend the
command handler to display employee details by opening a new Framework window.
To meet this objective you will complete the following steps:
Step 1. Extend Pop-Up Menu in Employee Image Object
Step 2. Enhance Employee Images for Section Command Handler
Step 3. Change Employee Details Command Handler
Step 4. Ensure Details displayed for first Employee
Before You Begin
Complete exercises VFW030, VFW040, VFW042, VFW100 and VFW104 before starting this exercise.
In exercise VFW104, you implemented
as a business object which is visible in the panel, with a filter to populate the instance list. In this exercise you will add the ability to open in a new window from the command handler, working with the Sections business object itself. This will enable a 'switch back' to be implemented from to in the main VLF window.