DX Tips and Tricks

Adding Callbacks

Database Xcessory makes it easy to add callbacks in order to specify additional application-specific behavior. You can write your own, user-defined callbacks, or you can use pre-defined callbacks that are already written and ready to use.

To add a callback:

  • Select a widget and find its appropriate callback resource (for example, activateCallback) in the Resource Editor.
  • Click on the "..." button next to the resource name to display the Callback Editor.

Using the Callback Editor, you can perform the following operations:

  • Create your own callbacks.
  • Use predefined callbacks, which are common callbacks already written and ready to use.

Adding Your Own Callback

To add your own callback:

1. Edit the fields in the Callback Editor.
2. Click on Apply.

When generating code, Database Xcessory creates a stub function into which you can add application-specific code

Adding a Pre-defined Callback

To add a pre-defined callback:

  1. Click on the arrow by the Procedure Name field to display a list of all available pre-defined callbacks.
  2. Select a callback and enter a value in the Parameter field (if appropriate).
  3. Click on Apply.

Using pre-defined callbacks allows you to test their behavior in Play Mode.

  • Note that you cannot test the behavior of your own callbacks in Play Mode. You can, however, test applications with predefined callbacks (callbacks provided by DX) in Play Mode.

Callback Example: Adding an Exit Button

In this example, let's assume that you want to add an Exit button to the Control Panel. When you create a Control Panel, a container of control buttons is created. The buttons allow the user begin and stop a search; go to the first, last, next, or previous record; delete and insert records; and cancel and commit changes made to records.

To add an Exit button:

  1. Create a push-button and add it to the Control Panel (for example, by dragging the push-button object and dropping it onto the control object in the Browser hierarchy).
  2. Change the labelString resource to "Exit."
  3. Call up the extended editor for activateCallback and select the pre-defined callback BxExitCB.
  4. Enter "0" in the Parameter input field.

After applying your changes and dismissing the callback editor, you could then enter Play Mode and test the new Exit button in the Control Panel on your application.

Additional Resources

  • Refer to Appendix B--Pre-defined Callbacks in DX HyperHelp for descriptions of DBPak-specific callbacks.