Step 4 Create a Dummy Accounts Command Handler

VLF Windows Application Development

Step 4. Create a Dummy Accounts Command Handler

VFW124 – Using Business Object SubTypes

Once again, as you are developing a demonstration application, the command handler will be common for all Accounts actions.

1.  Create a new Reusable Part / Panel:

     Name: iiiVFW40

     Description: Account Command Handler

2.  Replace its code with the following:

Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #VF_AC010) Height(242) Width(728)
Define_Com Class(#STD_TEXTL.Visual) Name(#STD_TEXTL) Caption('Account Holder') Displayposition(1) Height(19) Labeltype(Caption) Left(212) Marginleft(130) Parent(#COM_OWNER) Readonly(True) Tabposition(1) Top(115) Usepicklist(False) Width(257)
Define_Com Class(#STD_OBJ.Visual) Name(#STD_OBJ) Caption('Account Number') Displayposition(2) Height(19) Labeltype(Caption) Left(212) Marginleft(130) Parent(#COM_OWNER) Readonly(True) Tabposition(2) Top(145) Usepicklist(False) Width(257)
Define_Com Class(#STD_TEXTS.Visual) Name(#STD_TEXTS) Caption('Business Object SubType') Displayposition(3) Height(19) Labeltype(Caption) Left(212) Marginleft(130) Parent(#COM_OWNER) Readonly(True) Tabposition(3) Top(171) Usepicklist(False) Width(257)
Define_Com Class(#PRIM_LABL) Name(#LABL_1) Caption('This example uses an ACCOUNT business object. An ACCOUNT has 3 SubTypes identified as SAV (Savings), CHK (Check) and INV (Investment).') Displayposition(7) Height(24) Left(24) Parent(#COM_OWNER) Tabposition(7) Tabstop(False) Width(714)
Define_Com Class(#PRIM_LABL) Name(#LABL_2) Caption('SAV (Saving) subtype instances should only show tabs Details, Charges and History.') Displayposition(6) Height(25) Left(82) Parent(#COM_OWNER) Tabposition(6) Tabstop(False) Top(49) Width(442)
Define_Com Class(#PRIM_LABL) Name(#LABL_3) Caption('CHK (Check) subtype instances should only show tabs Details, Approve, Dates, History and Transactions.') Displayposition(5) Height(25) Left(81) Parent(#COM_OWNER) Tabposition(5) Tabstop(False) Top(64) Width(594)
Define_Com Class(#PRIM_LABL) Name(#LABL_4) Caption('INV (Investment) subtype instances should only show tabs Details, History, Schedule and Transactions.') Displayposition(4) Height(25) Left(83) Parent(#COM_OWNER) Tabposition(4) Tabstop(False) Top(81) Width(578)
Mthroutine Name(uExecute) Options(*Redefine)
Invoke Method(#Com_Ancestor.uInitialize)
Invoke Method(#avListManager.GetCurrentInstance) Akey1(#STD_OBJ) Visualid2(#STD_TEXTL) Subtype(#STD_TEXTS)
Endroutine
End_Com

 

3.  Compile the reusable part and review its logic.

a.  The user interface contains simply account number, name and subtype.

b.  The uExecute method, retrieves these three values for the current instance list entry.

4.  Open the Properties dialog for Accounts. Select the Commands Enabled tab.

5.  Select each command and plug in the command handler, iiiVFW40.

     Plug in the Approve command handler using the Find dialog, so the plug in uses the Identifier. Note the Identifier name and plug this in to all other commands for Accounts.

6.  Save and Restart your Framework.

7.  Test your Accounting application which demonstrates the use of Subtypes. Select instance list entries for each subtype and confirm the correct commands are enabled.