Callback View

Abstract

This article shows you how to use the Callback View and create, reuse, and manage callback methods.

Introduction

In the main panel of Rich Application Presentation Designer, the user can define events notifications for each widget. However, the control over this feature is limited to creating new callbacks and defining the functions to call for each widget callback notification. In particular, it’s impossible to rename an existing callback function, or to delete them.

In order to perform those operations, we provide an additional view, the callback view, to extend the callbacks design capabilities.

Accessing the Callback View

The callback view is displayed when the “Callback view” tab is selected on the main tab container.

The left panel shows a static view of the edited dialog box, without any design functionalities. It’s still possible to access the content of an icon box or to change the displayed tab page on a tab container.

The right panel shows the list of created callback functions. For each callback function, this tree view shows the widgets notifications that use this function.

Viewing the Widgets Notifications

When a widget is selected, a control appears next to him to show the list of notification that this widget supports (if this widget defines at least one event).

A tooltip associated to each notification describes its role.

Creating a Callback Method

You can either automatically create a callback method name, or specify this callback method name in two ways:

Generating a Method Name Automatically

If no function is associated to a widget callback notification, the button on the right of the notification can be used to automatically generate a new method.

When the method is created, the designer switches to the code view, with the cursor placed at the beginning of the start of the callback function implementation.

Specifying the Method Name

The editor next to the notification name handles the function that will be associated to the notification. After clicking on the grayed editor, this one is converted to an editable combo box, where the user can enter the name of the function to create.

When the name is validated, the designer will also switch to the code view, so that the user can write the implementation of its method.

The newly created function is added in the tree view in the callback view right panel. Here we see that our OnAdd method is used by the widget PushButton1, on the Pressed notification.

After the operation, the button that was used to create the callback becomes a shortcut to go to the implementation of the callback. A tooltip on this button also shows the code of the function.

Reusing an Existing Callback Method

When clicking on the function name editor, the combo that appears contains the list of existing functions. In this case, when the selection is validated, we don’t switch to the code view, since the callback is already defined (and likely implemented).

Managing the Callback Methods

Each callback function can be controlled in the Callbacks tree view. A function can be deleted using the context menu on the function node, or using the delete key. It can be renamed with the context menu, or with two slow clicks on the tree node.

When a function is deleted or renamed, each widget that uses this function is updated to reflect this modification.

This tree view also handles the widgets that are attached to a function. A tree sub item defining a widget/notification association can be deleted to remove the link between the widget notification and the callback function.

Finally, this view shows graphically the widgets that uses a function. If a function node is selected, then the drawn dialog box will highlight its widgets dependencies. If a widget notification node is selected, the designer will only highlight the widget.

In Short

The Callback View is dedicated to deal with callback methods. From this view, you can find the widget notifications, create, reuse, and manage callback methods, .