Programmatically 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 OfType(XXXXXXX) names you specify on calls to avShowWindow are Object User Object / Type values specified on the Identification tab of the properties of the respective object:
Using the avShowWindow method
When the avShowWindow 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 Window Opening Information ).
- 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 "Display a window with this name and pass this information into it, then cause it to switch to this application or this business object".
When you create a new window or switch an existing window it happens asynchronously to your program. So if you use avShowWindow and then immediately enumerate all open windows you will not find the window you just created (yet).
Window NamesYou 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 signaling or switching window TESTWINDOW only refers to it within the current X_RUN.EXE process. No intra-process windows operations are currently provided.