Example of a Hidden Command Handler for Windows Applications
* ================================================================================
* Type : COMMAND HANDLER
* Platform : MS-WINDOWS (Visual LANSA)
* Ancestor : VF_AC020
* Copyright : (C) Copyright
* Framework : Dem Framework
* ================================================================================
* An instance level command, reverses the Employee Name in the instance list.
* ================================================================================
Function Options(*DIRECT)
BEGIN_COM ROLE(*EXTENDS #VF_AC020)
* ================================================================================
* Simple Field and Group Definitions
* ================================================================================
DEFINE FIELD(#REVSD) REFFLD(#VF_ELBOOL)
DEF_COND NAME(*REVSD) COND('#REVSD *EQ TRUE')
* ================================================================================
* Handle Command Execution
* ================================================================================
Mthroutine Name(uExecute) Options(*REDEFINE)
* Do any execution logic defined in the ancestor
Invoke #Com_Ancestor.uExecute
* Get the Employee number of the current instance
Invoke #avListManager.GetCurrentInstance AKey1(#EMPNO) AColumn3(#REVSD)
* Fetch information from the main file to fill in the header fields on the form
FETCH FIELDS(#SURNAME #GIVENAME) FROM_FILE(PSLMST) WITH_KEY(#EMPNO)
* Put the names together in the reverse order
If Cond(*REVSD)
* Put the names together Given name first
Change #UF_VisID2 #GIVENAME
Use BConcat (#UF_VisID2 #SURNAME) (#UF_VisID2)
* Set the reversed flag
Change #REVSD FALSE
Else
* Put the names together Surname first
Change #UF_VisID2 #SURNAME
Use BConcat (#UF_VisID2 #GIVENAME) (#UF_VisID2)
* Set the reversed flag
Change #REVSD TRUE
Endif
* Update the name (Visual ID 2) to the instance list
Invoke Method(#avListManager.UpdateListEntryData) AKey1(#EMPNO) Visualid2(#UF_VisID2) AColumn3(#REVSD)
Endroutine
End_Com