How To : Adding an Interface

Page Status: Beta
Jump to: navigation, search

Back to Concepts and HOW TOs

Contents

[edit] Description

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

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

[edit] Prerequisites

Understanding Interfaces
Introduction to MVA
Understanding the Interface Tab

[edit] Procedures

[edit] Adding an Interface in the Solution Explorer

To add an interface to your project:

  1. Right-click on the project and select Add Interface.
  2. In the dialog box that's displayed, do the following:
    1. In Name, type a name for the interface.
    2. In Interface Type, click the arrow in the drop-down box and select the interface type.
      1. If you are adding an adapter interface, click the arrow in the drop-down box and select the Adapter Interface interface type.
      2. Next to Adapter Type click the down arrow and select the adapter type. 
    3. Click OK.
  3. The interface is added to the project and automatically selected.

[edit] Adding an Interface from the Interface Tab

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

To add an interface from the interface tab

  1. In the Design Editor, select the control to which you want to assign an interface.
  2. In the Property Editor, click the Interface tab.
  3. In the column on the left, select the property category (Adapters, Forms, Functions) of interface 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 interface by clicking the ellipsis button [...].

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

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

[edit] Choosing an Interface

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

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

To add an interface from the interface tab

  1. In the Design Editor, select the control to which you want to assign an interface.
  2. In the Property Editor, click the Interface tab.
  3. In the column on the left, select the property category (Adapters, Functions, Forms) of interface 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 interface by clicking the ellipsis button [...].
    1. In the Choose (interface type) Interface dialog, select Add a new (interface type).
    2. In the Name text box, provide a name for your interface.
    3. In the Choose A Project box, select the project in your solution where you want your interface to be added.
    4. Click OK. The interface is added to the project. To verify, in the Solution Explorer, expand the project to which you added the interface. Your new interface should be visible beneath the classes in your project tree.

[edit] Deleting an Interface

To delete an interface from your project:

  1. Select the interface.
  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 an adapter interface from the Solution Explorer.

[edit] Next Steps

Using Function Interfaces
Add an adapter to your class

[edit] Tags

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