Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The following steps provide an overview of how to write a new Windows layout control for Aptify: Note:

Note

If using the template provided by Aptify for this project, configure the template as described in

...

Loading the Sample Code and Templates

...

, rename the project and class, and skip to Step 9.

 

  1. Open a new Class Library project in Visual Studio.
  2. Configure the Properties for the project.
    • When assigning an assembly name for this object, use this format: [EntityName]LayoutControl (remove spaces in the entity name)For example: RentalAgreementsLayoutControl (or SampleRentalAgreementsLayoutControl, as shown in

...

    • the figure below).
    • Specify a root namespace for your project.For example: Aptify.SampleApplication.MotorLoaner, as shown

...

    • below.  

      Entity Object PropertiesImage Added
  1. Click the References tab in the Properties page and add a reference to the following Aptify objects:
    • AptifyApplication
    • AptifyExceptionManagement
    • AptifyFormTemplateControls
    • AptifyGenericDataServices
    • AptifyGenericEntity
    • AptifyGenericEntityBase
    • AptifyUtility
    • AptifyWindowsControls
    • IAptifyDataServices
    • IAptifyFormTemplateHost
    • System.Windows.Forms (this is a Microsoft .NET object)

...

    • Info

      References to the following Microsoft Objects should already exist in the project: System, System.Data, and System.Xml. You can find the Aptify objects in your Aptify Windows application'

...

    • C:\Program Files\Aptify 5.5

...

    •  directory.

  1. Open the class file.
  2. Add Option Explicit On and Option Strict On at the top of the class file (as described in "Use Option Explicit and Option Strict" on page 71.
  3. Add Imports Aptify.Framework.WindowsControls namespace to the class file to import the Aptify Windows Controls.
  4. Define the name for your class (typically this is Public Class [Entity Name]Layout).
  5. Add Inherits FormTemplateLayout below the class name. Layout Control Inheritance Image Removed

     Layout Control InheritanceImage Added
  6. Declare the instances of the controls from the form with which this class will interact.
    • In

...

    • following figure, the RentalAgreementsLayout declares a variable for each field displayed on the Rental Agreements form. Each field has a variable that is declared as an instance of its particular Aptify Windows Control, such as an AptifyLinkBox or AptifyTextBox.

...

    •  

      Declare ControlsImage Added
  1. Write a FindControls method to locate the controls on the form and assign them to the variables you declared to handle events.
  2. See the source code for the RentalAgreementsLayoutControl for its implementation of FindControls, a portion of which is shown in

...

  1. the figure below. 

    FindControls Method ExampleImage Added
  2. Override the OnFormTemplateLoaded method that is called when the form has loaded.
  3. Write code to define the behavior required of the Layout Control.
    • See the source code for the Rental Agreements Layout Control for an example of how to implement control visibility.
    • The layout control implements three phases of a Rental Agreements record (Check-Out, Check-In, and Complete) and sets control visibility according to each phase. See

...

...

    •  for an overview of how this control visibility translates to the user experience.
    • See the _m_lnkVehicleID_ValueChanged_ method in the Rental Agreements Layout Control's source code for an example of how to automatically populate one field (StartingMileage) when a user populates another field (VehicleID) on the form.

...

    • See the Aptify Software Development Kit (SDK) for information on other layout controls created for Aptify business applications, including these classes:
      • Companies: Aptify.Applications.Companies.CompaniesLayout
      • Persons: Aptify.Applications.Persons.PersonsLayout
      • Products: Aptify.Applications.ProductSetup.WindowsControls.ProductLayout
      • Orders: Aptify.Applications.OrderEntry.WindowsControls.OrdersLayout
         
  1. Build, test, and sign the assembly. See "Recommendations for Best Practices When Writing Code " on page 68 for Aptify for details.
  2. Add the assembly to the Aptify Object Repository and link it to the appropriate form's top-level Form Templates record.
    • See

...

...

    •  for instructions on how to add the layout control to Aptify.