How To : Using Function Interfaces

Page Status: Beta
Jump to: navigation, search

Back to Concepts and HOW TOs

Contents

[edit] Description

If you want to invoke a function in your Model code based on user interaction with a portion of your application's View (a control), you must first add an interface. Once you have added a function interface, you must then assign the interface to both the control and the function you want to invoke. The steps below help you make the appropriate assignment and ensure that your function signature is correct.

[edit] Prerequisites

Understanding Function Interfaces
Understanding the Interface Tab
Adding an Interface

[edit] Procedure

To assign a function interface to both your View (control) and your Model (function)

  1. In the Design Editor, select the control from which you want to invoke your function.
  2. In the Property Editor, click the Interface tab.
  3. In the column on the left, select the Functions property category.
  4. Select the property appropriate to the user interaction that you want to invoke your function (for instance, if you want to call a function to handle a double-click, select the Double Click property).
  5. When assigning a function interface to the control, in the column on the right you can either:
    • Click the ellipsis button [...] and with Choose an existing FunctionInterface selected, in the Choose FunctionInterface dialog, choose an interface from either the Runtime tab or the current solution tab, then expand the project which cotains the interface you want, and after selecting that interface, click OK.
    • Click the Set Default Interface button (see tooltip).
  6. If you have not yet created a function in your current class that you want to invoke based on user interaction with the control to which you assigned the interface, click the Add Function button (see tooltip).
  7. In the Function column, select the  function you want to invoke.
  8. On the far right of the Interface tab, click the Bind button.

    Note The Bind button "binds" the function to the control by assigning the same interface to the function that you already assigned to the control.

  9. If the function signature of the function you selected in the step above does not match what is required for the interface you assigned to the function with the Bind button, a message is invoked asking if you would like to correct the signature. Click OK.

    Note You can choose to add the function signature yourself by adding the needed arguments through the Solution Details pane. To be sure you have the proper signature, see the documentation for the property through which you assign the interface to the control.

[edit] Error Handling

 

[edit] Examples

 

[edit] Next Steps

 

[edit] Tags


Log in if you would like to rate this page.
    Copyright © 2005 - 2008 Bungee Labs. All rights reserved.