Command Handlers and List Manager
The instance list allows the end-user to select one or more business object instances and then execute a command (i.e. a command handler):
In your command handler you often need to find out:
- The Current Instance which is the selected instance, if there is only one, or the instance with the focus if there are more.
- The Selected Instances which are all the instances that have been selected.
You can use these List Manager methods in your command handlers:
In Windows and WAM Applications |
Description | |
Used to ask the list manager for details of the current business object instance. If your command handler is designed to handle single business object instances, for example for displaying the details of a specific product, you need to use this method to find out what the current product is. |
||
Used to ask the list manager to return all selected instances in the list. Some command handlers are designed to work with multiple object instances (eg: Printing details of all selected employees). |
||
Not currently available for WAMs |
Used to ask the list manager to return the unique identifier and the visual identifiers for an instance in the instance list. AKeyn and NKeyn values are required to uniquely identify the instance to be read. |
|
Used to ask the list manager to return all instances entries in the list. This method allows command handlers to be designed to work with all object instances returned by a filter. |
||
Invoke #avListManager.AlterColumnHeadings
Not currently available for WAMs.
|
Is used to override the instance list column headings at run time. This can be used to make the instance list suit the result of different filter searches. |
|
Invoke #avListManager.ResetAlteredHeadings
Not currently available for WAMs.
|
Is used to remove all overrides the instance list column headings. |
|
Invoke #avListManager.DisplaySorted
Not currently available for WAMs. |
Is used to sort the instance list by a visible or hidden column, at run time. Up to four sort columns can be specified. |
In Windows applications the list manager also signals a ListSelectionChanged event which you might want to listen to use in more complex command handlers. It is signaled whenever the selected set of object instances changes. In Web browser applications the same event is handled by completely (re)executing your command handler. There are examples of this type of event handling in the shipped demonstration and programming techniques applications.
Note: You should not attempt to change the content or selection in the instance list in any way within a ListSelectionChanged event handler.
The programming model used to manage instance lists is the same in Windows and Web browser applications. This is how you would find out what the current Employee is an Employees instance list in a Windows or WAM application:
Invoke #avListManager.GetCurrentInstance AKey1(#EMPNO)
This is how you would find all the Employees that are currently in an instance list whether they are selected or not:
Def_cond *RetOkay '#RetCode = OK'
Invoke #avListManager.GetInstance First(TRUE) Akey1(#Empno)
ReturnCode(#RetCode)
DoWhile *RetOkay
Fetch Fields(…..whatever ….) From_File(PSLMST) With_Key(#Empno)
Invoke #avListManager.GetInstance First(FALSE) Akey1(#Empno)
ReturnCode(#RetCode)
EndWhile