Constructing the OAContractView Part


OAContractView composition illustration

  1. Create a visual part as follows:

    The part opens in the Composition Editor.

  2. For this part, the client area requires 19 rows and 11 columns. Make the following expandable:

  3. Add parts that require labels to the client area as follows. Shorthand used in these tables corresponds to (rowNumber, columnNumber). Where an entry in the table is blank, the value is optional.

    Table 6. Label Parts for OAContractView
    Add... From... To... Change it to read...
    IStaticText* (2,2) (2,3) Account Number
    IStaticText* (4,2) (4,3) Company Name
    IStaticText* (6,2) (6,3) Project Manager
    IStaticText* (8,2) (8,3) Department
    IGroupBox* (10,2) (18,10) Position Details
    IStaticText* (13,3)
    Title
    IStaticText* (15,3)
    Start Date
    IStaticText* (15,7)
    End Date
    IStaticText* (17,3)
    Contractor

  4. Add entry parts to the client area as follows:

    Table 7. Entry Parts for OAContractView
    Add... From... To... Name it... Limit of...
    IEntryField* (2,5) (2,10) AccountNumEF 6
    IEntryField* (4,5) (4,10) CompanyEF 25
    IEntryField* (6,5) (6,10) ProjMgrEF 25
    IEntryField* (8,5) (8,10) DepartmentEF 25
    IEntryField* (13,5) (13,9) TitleEF 25
    IEntryField* (15,5)
    StartDateEF 8
    IEntryField* (15,9)
    EndDateEF 8
    IEntryField* (17,5) (17,9) ContractorEF 25

    In all entry parts, set the tabStop style property on. Make sure the parts are arranged in the appropriate depth order. (If necessary, use the parts list to reorder them.)

    In AccountNumEF and TitleEF, set the group style property on.

  5. In the ButtonBar part, add and edit the buttons so that they appear in the following order. To even out button size, set the packType property of ButtonBar to expanded. If necessary, use the parts list to reorder the buttons.

    Table 8. Button Parts for OAContractView
    Name it... Change label to read...
    RefreshPB Refresh
    SavePB Save
    ClearPB Clear
    CancelPB Cancel
    HelpPB Help

    Set RefreshPB as the default button.

  6. To enable help, add an IHelpWindow* part. Set it as follows:

  7. To manage data in the IEntryField* parts, add a Variable part. Name it Contract and give it a type of OAContract*.

  8. Promote the this attribute of the Contract variable.

  9. To handle data access exceptions, add an IMessageBox* part; name it NotFound.

  10. Connect parts as follows. The connection from CancelPB to the IFrameWindow* part was drawn when you created the part. For simplicity's sake, this table assumes that it is the first connection (conn0).

    Table 9. Connections for OAContractView
    Connection number From Part, feature... To Part, feature...
    1 Contract, accountNum AccountNumEF, text
    2 Contract, companyName CompanyEF, text
    3 Contract, projectMgr ProjectMgrEF, text
    4 Contract, department DepartmentEF, text
    5 Contract, positionTitle TitleEF, text
    6 Contract, startDate StartDateEF, text
    7 Contract, endDate EndDateEF, text
    8 Contract, contractorID ContractorEF, text
    9 RefreshPB, buttonClickEvent Contract, getContract
    10 conn9, anAccountNum Contract, accountNum
    11 conn9, exceptionOccurred NotFound, showException
    12 SavePB, buttonClickEvent Contract, putContract
    13 conn12, anAccountNum Contract, accountNum
    14 conn12, exceptionOccurred NotFound, showException
    15 ClearPB, buttonClickEvent OAContractView, resetFields ( a member function attached to the composite)

  11. Write the resetFields( ) member function as shown in oaconv.cpv. Be sure to select the check boxes for both the .cpv and .hpv files, or they will not be included in generated code.

    The clear function could have been implemented in other ways: we could have drawn individual connections to each entry field, or we could have cleared the information through the clear function in OAContract.


Related procedures
Constructing the OAContractorView Part
Constructing the OASkillView Part
Working with Parts in the Composition Editor
Editing Part Properties
Dropping Parts in the Composition Editor
Listing Parts within a Composite Part
About Promoting Part Features
Making Connections in the Composition Editor

Related references
IEntryField
IGroupBox
IMessageBox
IMultiCellCanvas
ISetCanvas