How To : Using Function Interfaces
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)
- In the Design Editor, select the control from which you want to invoke your function.
- In the Property Editor, click the Interface tab.
- In the column on the left, select the Functions property category.
- 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).
- 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).
- 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).
- In the Function column, select the function you want to invoke.
- 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.
- 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



