Notifying other Windows of Significant Events

In VLF-WIN the avSignalEvent method may be used to notify other windows of an event.


To control the scope of the signal use the WindowScope() parameter, which may be specified as CURRENT, ALL, MAIN or a specific window name.

The default value for this parameter is CURRENT.


Using the 'Wake Up' Method uShowWindowCompleted

The signaling approach works well when you know the window in question is open and listening for the event.


However, what if you don't know whether the window in question is actually open? This situation is easiest to handle this way.


Imagine a command handler or filter in the MAIN window that executes this method:


#AvFrameworkManager.avShowWindow Caller(#Com_Owner) For(BUSINESSOBJECT) ofType(EMPLOYEES)

                                 WindowName(EMP_WINDOW) OpenInfo1(#EMPNO)



What this says is "Show a window named EMP_WINDOW (creating it if you need to). It should contain just the EMPLOYEES business object. Set its opening information string to the value of #EMPNO".


Now imagine a filter (or command handler) that is either started, or already active, inside the window EMP_WINDOW.


It has this special 'Wake up' method in it:


Mthroutine uShowWindowCompleted Options(*Redefine)


   #Empno := #Com_Owner.avCurrentWindow.OpenInfo<1>


   Use message_box_show (ok ok info *Component #Empno)





This method is invoked every time some other window executes:


        #AvFrameworkManager.avShowWindow WindowName(EMP_WINDOW)


In other words, this is a method that is saying 'wake up, another window wants you to do something'. Typically the command handler or filter that is 'woken up' would use information passed in the open information strings to determine what it should do next.


This feature may be used to interlink high level business objects. For example imagine a window working with details named CUSTOMER_WINDOW and another working with order information named ORDER_WINDOW.


Scattered through the command handlers belonging to CUSTOMER_WINDOW you would find method calls like this:


#AvFrameworkManager.avShowWindow Caller(#Com_Owner) For(BUSINESSOBJECT)

                                  ofType(ORDERS) WindowName(ORDER_WINDOW)





Scattered through the command handlers belonging to ORDER_WINDOW you would find method calls like this:


#AvFrameworkManager.avShowWindow Caller(#Com_Owner) For(BUSINESSOBJECT)

                                  ofType(CUSTOMERS) WindowName(CUSTOMER_WINDOW)




Orders and Customers are now interlinked making it very easy for an end-user to swap between the two applications.