*=============================================================================* * Component : UF_QRY01* Type : Reusable Component* Ancestor : VF_AC010 (Command Handler)* * PLEASE NOTE: This UF_ (User Framework) component is the shipped version. You* may choose to modify it. You should do this by copying the source* code of this component into your own component and then change* the copied version. This will prevent the accidental loss of your* changes if you upgrade your Visual LANSA Framework version. Refer* to the end of this component for more details about making your* own version of this component.* * This is example code only - No warranty is expressed or implied.* Neither this program, nor any derivative of it, should be ever be used in* production or end-user environments.* * =============================================================================* * This is the simplest example of how to listen for general Framework objects and view their properties* =============================================================================Function Options(*DIRECT)Begin_Com Role(*EXTENDS #VF_AC010) Height(336) Layoutmanager(#ATLM_2) Width(552)* ================================================================================* Simple Field and Group Definitions* ================================================================================* ================================================================================* Component definitions* ================================================================================* Body and Button arrangement panelsDefine_Com Class(#PRIM_PANL) Name(#BUTTON_PANEL) Displayposition(2) Height(336) Layoutmanager(#BUTTON_FLOW) Left(464) Parent(#COM_OWNER) Tabposition(2) Tabstop(False) Top(0) Width(88)Define_Com Class(#PRIM_PANL) Name(#BODY_HEAD) Displayposition(1) Height(336) Layoutmanager(#ATLM_1) Left(0) Parent(#COM_OWNER) Tabposition(1) Tabstop(False) Top(0) Verticalscroll(True) Width(464)* Attachment and flow layout managersDefine_Com Class(#PRIM_ATLM) Name(#MAIN_LAYOUT)Define_Com Class(#PRIM_ATLI) Name(#BUTTON_ATTACH) Attachment(Right) Manage(#BUTTON_PANEL) Parent(#MAIN_LAYOUT)Define_Com Class(#PRIM_FWLM) Name(#BUTTON_FLOW) Direction(TopToBottom) Flowoperation(Center) Marginbottom(4) Marginleft(4) Marginright(4) Margintop(4) Spacing(4) Spacingitems(4)Define_Com Class(#PRIM_ATLI) Name(#BODY_ATTACH) Attachment(Center) Manage(#BODY_HEAD) Parent(#MAIN_LAYOUT)* The report buttonDefine_Com Class(#PRIM_PHBN) Name(#PHBN_REPORT) Buttondefault(True) Caption('Report') Displayposition(1) Left(4) Parent(#BUTTON_PANEL) Tabposition(1) Top(4)Define_Com Class(#PRIM_FWLI) Name(#FWLI_SAVE_BUTTON) Manage(#PHBN_REPORT) Parent(#BUTTON_FLOW)* The Traverse componentDefine_Com Class(#UF_TRVRS) Name(#UF_TRVRS)Define_Com Class(#PRIM_ATLM) Name(#ATLM_1) Marginbottom(2) Marginleft(2) Marginright(2) Margintop(2)Define_Com Class(#PRIM_ATLI) Name(#ATLI_1) Attachment(Center) Parent(#ATLM_1)Define_Com Class(#PRIM_ATLM) Name(#ATLM_2)Define_Com Class(#PRIM_ATLI) Name(#ATLI_2) Attachment(Center) Manage(#BODY_HEAD) Parent(#ATLM_2)Define_Com Class(#PRIM_ATLI) Name(#ATLI_3) Attachment(Right) Manage(#BUTTON_PANEL) Parent(#ATLM_2)Define_Com Class(#Prim_kCol<#VF_FP003 #VF_ELIDN>) Name(#collBusObj)* List of the GUIDs of all the CommandsDef_List Name(#ListCmdGd) Fields(#cmdGUID #cmdUID) Type(*Working) Entrys(*MAX)define #cmdGUID reffld(#vf_elidn) desc('GUID for a command definition')define #cmdUID reffld(#vf_elidn) desc('uIdentifier for a command definition')* List of the GUIDs of all the Command ReferencesDef_List Name(#ListCmRGd) Fields(#cmdRefGUD #cmdRefUID) Type(*Working) Entrys(*MAX)define #cmdRefGUD reffld(#vf_elidn) desc('GUID for a command reference')define #cmdRefUID reffld(#vf_elidn) desc('uIdentifier for a command definition')Define_com #VF_FPM09 #TheVF_FPM09 Reference(*Dynamic)Define_com #VF_FPM10 #TheVF_FPM10 Reference(*Dynamic)Define_Com Class(#PRIM_LTVW) Name(#LTVW_1) Componentversion(2) Displayposition(1) Fullrowselect(True) Height(332) Left(2) Parent(#BODY_HEAD) Showsortarrow(True) Tabposition(1) Top(2) Width(460)Define_Com Class(#PRIM_ATLI) Name(#ATLI_4) Attachment(Center) Manage(#LTVW_1) Parent(#ATLM_1)Define_Com Class(#PRIM_LVCL) Name(#LVCL_1) Caption('Unused Commands') Captiontype(Caption) Displayposition(1) Parent(#LTVW_1) Source(#DF_ELTXTL) Width(100)* ================================================================================* Events Definitions* ================================================================================* ================================================================================* Property Definitions* ================================================================================* ================================================================================* Method Definitions* ================================================================================* --------------------------------------------------------------------------------* Handle Command Execution* --------------------------------------------------------------------------------Mthroutine Name(uExecute) Options(*REDEFINE)* The return code field and testing conditionDefine #Ret_Code reffld(#IO$STS)Def_cond Name(*RetOkay) Cond('#Ret_Code = OK')* Do any execution logic defined in the ancestorInvoke #Com_Ancestor.uExecuteEndroutine* ================================================================================* Subroutines* ================================================================================* ================================================================================* Event Handlers* ================================================================================* --------------------------------------------------------------------------------* Handle the save button* --------------------------------------------------------------------------------EVTROUTINE HANDLING(#PHBN_REPORT.Click)* Clear Listsclr_list #listCmdGDclr_list #listCmRGD* Tell the Traverse reusable part to read through the entire system in no particular order* This program listens for the signals for each new object,* Collect all the informationinvoke #UF_TRVRS.uTraverseFramework* Now display a list of any commands that are not referenced by anythinginvoke #Com_Owner.Check_UnusedENDROUTINE* Listen for a Business Object - An example of storing ordinary objectsEVTROUTINE HANDLING(#UF_TRVRS.BusinessObject) Reference(#TempVF_FP003)* Store all the business objects in a collectionSet_ref Com(#collBusObj<#TempVF_FP003.uIdentifier>) to(#TempVF_FP003)endroutine* Listen for a Command Definition ObjectEVTROUTINE HANDLING(#UF_TRVRS.CommandDefinition) Reference(#TempVF_FPM09) * All the Command Definitions are stored as internal members of a single object, #VF_FPM09.* There is only one object reference that needs to be storedset_ref #TheVF_FPM09 #TempVF_FPM09* But to access the information about a particular Command Definition, we need to know* the value of a special property called .CurrentMemberGUID.* So, store that value in a listChange #cmdGUID #TempVF_FPM09.CurrentMemberGUIDChange #cmdUID #TempVF_FPM09.uIdentifierAdd_entry #ListCmdGDendroutine* Listen for a Command Usage (Command Reference) ObjectEVTROUTINE HANDLING(#UF_TRVRS.CommandReference) Reference(#TempVF_FPM10) CommandDefinition(#TempVF_FPM09) * All the Command References are stored as internal members of a single object, #VF_FPM10.* There is only one object that needs to be storedset_ref #TheVF_FPM10 #TempVF_FPM10* But to access the information about a particular Command Reference, we need to know* the value of a special property called .CurrentMemberGUID.* So, store that value in a listChange #cmdRefGUD #TempVF_FPM10.CurrentMemberGUID* Store the uIdentifier of the command that is refered toChange #cmdRefUID #TempVF_FPM09.uIdentifierAdd_entry #ListCmRGdENDROUTINE* Check which commands are not used anywheremthroutine Check_Unusedclr_list #LTVW_1selectlist #ListCmdGD* Which commands do not have a Command Reference that uses them?Loc_Entry In_List(#ListCmRGd) Where(#cmdUID *eq #cmdrefUID)if_status is_not(*Okay)* Get Details of the command definition being processed* (Set the GUID property first)set #TheVF_FPM09 CurrentMemberGUID(#cmdGUID)#df_eltxtl := 'Command: ' + #TheVF_FPM09.uCaption.AsNativeString + ' is not used anywhere' * To see what other command definition properties you can view, click on #The VF_FPM09 above and press F2, and look at the properties of the VF_FPM09 classadd_entry #LTVW_1endifendselectendroutineEnd_Com