How To : Adding an Adapter

Page Status: Beta

Back to Concepts and HOW TOs

Contents

[edit] Description

This document describes different methods for adding an adapter to your project, as well as how you delete an adapter.

Note Once you have added the adapter, you must also bind your View to your Model, by assigning the adapter to both an element of your View and element of your Model, using the properties on the Adapter tab to assign the adapter to a control (View), and the Adapter List property to assign the same adapter to a member of your class (Model).

[edit] Prerequisites

Understanding Adapters
Introduction to MVA
Understanding the Adapter Tab

[edit] Procedures

[edit] Adding an Adapter in the Solution Explorer

To add an adapter to your project:

  1. Right-click on the project and select Add Adapter.
  2. In the dialog box that's displayed, do the following:
    1. In Name, type a name for the adapter.
    2. In Adapter Type, click the arrow in the drop-down box and select the adapter type.
      1. If you are adding a connection adapter, click the arrow in the drop-down box and select the Connection Adapter adapter type.
      2. Next to Connection Type click the ellipsis button [...].
      3. In the Select Class dialog, select the Dependencies tab and navigate to the TypLib: ControlConnection project and choose the control for which you want your adapter to provide an interface.
      4. Click OK.
    3. Click OK.
  3. The adapter is added to the project and automatically selected.

[edit] Adding an Adapter from the Adapter Tab

Using this methodology both adds the adapter to your project and assigns the adapter to your View (control).

To add an adapter from the adapter tab

  1. In the Design Editor, select the control to which you want to assign an adapter.
  2. In the Property Editor, click the Adapter tab.
  3. In the column on the left, select the property category (Connections, Functions, Forms) of adapter you want to assign to the control.
  4. Select the property appropriate to the control behavior you want to govern (for instance, if you want to establish a behavior to handle when a user double-clicks the control, select the Double Click property).
  5. Add an adapter by clicking the ellipsis button [...].

    Note Properties for connection adapters assign an adapter to the control by default. This default can be removed by clicking the clear adapter button, or you can change the default by following the steps below. You can also resestablish the default by clicking the Set Default Adapter button.

    1. In the Choose (adapter type) Adapter dialog, select Add a new (adapter type).
    2. In Name, type a name for the adapter.
    3. From the Choose A Project drop-down box, choose the project to which you want to add the adapter.
    4. Click OK.

[edit] Choosing an Adapter

Rather than adding a new adapter to your project, you can choose a pre-existing system provided adapter, or you can reuse an adapter you have previously created. The process of choosing an adapter also assigns the adapter to your View (control).

Note Once you have assigned the adapter to the control, you must also bind your View to your Model, by assigning the adapter to both an element of your View and element of your Model, using the properties on the Adapter tab to assign the adapter to a control (View), and the Adapter List property to assign the same adapter to a member of your class (Model).

To add an adapter from the adapter tab

  1. In the Design Editor, select the control to which you want to assign an adapter.
  2. In the Property Editor, click the Adapter tab.
  3. In the column on the left, select the property category (Connections, Functions, Forms) of adapter you want to assign to the control.
  4. Select the property appropriate to the control behavior you want to govern (for instance, if you want to establish a behavior to handle when a user double-clicks the control, select the Double Click property).
  5. Add an adapter by clicking the ellipsis button [...].

    Note Properties for connection adapters assign an adapter to the control by default. This default can be removed by clicking the clear adapter button, or you can change the default by following the steps below. You can also resestablish the default by clicking the Set Default Adapter button.

    1. In the Choose (adapter type) Adapter dialog, select Add a new (adapter type).
    2.  

[edit] Deleting an Adapter

To delete an adapter from your project:

  1. Select the adapter.
  2. Click the Delete icon (red X) at the top of the Solution Explorer.

[edit] Error Handling


[edit] Examples

See the Google Maps (or any other service-based) tutorial.

Below is an example of adding a connection adapter from the Solution Explorer.

[edit] Next Steps

Using Function Adapters
Add a connection to your class

[edit] Tags

    Copyright © 2005 - 2007 Bungee Labs. All rights reserved.