How To : Using Function Adapters

Page Status: Beta

Back to Concepts and HOW TOs

Contents

[edit] Description

Add a function adapter to your project when you want to invoke a function in your Model code based on either user interaction or programmatic changes involving a portion of your application's View.

[edit] Prerequisites

Understanding Function Adapters

[edit] Procedure

To implement a function adapter and invoke a function

  1. Create a function in a class of your project.
  2. Add any needed arguments to your function. If you intend to use a particular function adapter to identify your function at runtime, you must inspect the function adapter for a list of the arguments you need to add to your function for the function adapter to properly identify your function. Currently, the only way to determine the arguments you need to add to your function, is to read the property documentation of the function adapter you add or access through the property (for example: Drag Function).
  3. Set the Type of your argument to the type identified in the Function Signature section of the function adapter property.

    Note When setting the argument type, you can verify the location of the TypeLib containing the needed type by clicking the linked type name under Type in the Function Signature section of the property.For example, in the Drag Function property, under Function Signature, click DragDrop under Type. The title of the page the link directs you to supplies the location you need to browse to under the Dependencies tab of the Chooser when you are setting the Type property.

  4. Next, using the Adapter List property on your function, specify the function adapter you want to identify your function.

    Note Alternatively, you can  add an adapter to your project, specifying that the adapter is a function adapter.

  5. Select the control you want to serve as the source of the operation that fires the function.
  6. Use that control's pertinent property to specify the same function adapter as you specified for the function. At runtime, the appropriate user interaction with that control triggers the function. For example, if you want to trigger a function based on a drag-and-drop, use the control's Drag Function property to specify the same function adapter as you did on your function. At runtime, when a user does a drag-and-drop, your function fires.

[edit] Error Handling

 

[edit] Examples

 

[edit] Next Steps

 

[edit] Tags

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