To add a Data Grid for the master side of the relationship

  1. Open the WinForm designer for the ECO-enabled Windows Form.
  2. Select the ExpressionHandle (ehRoot), and set its RootHandle property to rhRoot using the Object Inspector.
  3. While the ExpressionHandle is still selected, set its Expression property using the OCL expression editor. Using the example above, you might enter an OCL expression that results in a collection of Customer objects, such as Customer.alllnstances.
  4. Drag a DataGrid component from the Tool Palette onto the form.
  5. Set the grid's DataSource property to the ExpressionHandle, ehRoot.

If you are using an RDBMS as the persistence method, the DataGrid will display column headings that correspond to the attributes you have defined on the Customer class. The column headings will not display at designtime when persisting objects to an XML file, but they will appear at runtime.

Continuing with the Customer example, to populate the grid with a new instance of the Customer class, execute code such as the following: Customer newCustomer = new Customer (EcoSpace); Customer := Customer.Create(EcoSpace);

Where the EcoSpace parameter is the instance of your application's ECO Space that is allocated in your application's main WinForm. The grid is automatically synchronized with the ECO Space; when you create a new instance within the ECO Space, a new row is added to the grid.

Using the ECO framework it is quite simple to construct two grids that are linked together in a master/ detail relationship as described above. Linking grids together requires the use of a CurrencyManagerHandle object, and a second ExpressionHandle object to retrieve the objects on the detail side of the relationship.

The CurrencyManagerHandle manages the synchronization between the ExpressionHandle for the master objects, and the ExpressionHandle for the detail objects. It is helpful to think of the CurrencyManagerHandle object as sitting between the two ExpressionHandles:

EcoSpace <-- RootHandle <-- Master ExpressionHandle (master) <-- CurrencyManagerHandle<--Detail ExpressionHandle

Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook

Post a comment