Builder Xcessory allows you to add callbacks of your own design to the list of predefined callbacks in the Callback Editor. The procedure for adding predefined callbacks is similar to that of adding resource editors.
On most systems, Builder Xcessory dynamically loads the shared library containing the callbacks. If there is a function in that library called AddUserFunctions, it is called. In that function, you can make calls to other functions to register the callbacks with Builder Xcessory on all systems.
Systems running SunOS 4
On systems running SunOS 4, you must modify your interface file (
addWidgets.c in our example), and add to the AddUserFunctions defined in the file. Then, relink Builder Xcessory with
addWidgets.c and with a new file containing the callbacks, as described in Chapter 2--Adding Widgets.
Adding a Callback to Predefined Function List
void RegisterUserCallback(char *name
- XtCallbackProc fct,
void RegisterUserTypedCallback(char *name,
- XtCallbackProc fct,
In previous versions of Builder Xcessory, the third argument to RegisterUserCallback was the name of a file containing the code to insert in the user's callbacks file when generating code for the named function. The file containing the codemust now have the same name as the function. If this file cannot be found during code generation, Builder Xcessory produces only a stub function.
parameter_type The name of the type for the client data parameter to the callback. If you specify a type name, Builder Xcessory allows the user to specify the function's parameter, as long as its type is the same as the type named by parameter_type.
The following sections illustrate an example of adding the callback function InterceptWMDelete to the list of predefined callbacks in Builder Xcessory. InterceptWMDelete is written to be placed on a shell widget in its popupCallback.
Adding the function to Builder Xcessory
Ensuring that the user cannot enter client data
This example registers the function InterceptWMDelete. When generating code, Builder Xcessory looks for a file with the same name as this function, InterceptWMDelete. If this file exists, Builder Xcessory inserts the code from this file in the Callbacks file as long as the function InterceptWMDelete is referred to and not already in the Callbacks file.