Application Manager

Allows you to add work procedures and timer procedures to your application. These procedures are useful if your application requires tasks beyond processing events from the user.

Displaying the Application Setup dialog

Select Application from the Browser Managers menu to display the Application Setup dialog:

Application Setup Dialog

Work Procedures

A work procedure is a callback function that provides a limited form of background processing. The work procedure is invoked by the Xt Intrinsics whenever no other events are pending. That is, when X is idle (not drawing to the display or responding to user actions), the work procedure is called.

Adding a work procedure

Use a work procedure to specify a function to call when no other events are pending. Once called, a work procedure monopolizes the CPU. Therefore, a work procedure should be a function that executes quickly. Otherwise, the display stops responding to the user while the work procedure executes. For example, to perform a long calculation with work procedures, set up the calculation as an iterative process. Then, a small portion of the calculation can be done each time the work procedure is called. This approach avoids freezing the display.

Adding a work procedure by hardcoding

To add a work procedure by hardcoding, use the following function:

XtAppAddWorkProc(app_context, proc, client_data)

This function returns an ID that identifies the work procedure. The client_data parameter specifies application-defined data that is passed to the work procedure.

Adding a new work procedure using the Application Work Procedure Editor

To add a work procedure:

1. Click on the "..." button next to the Work Procedures input field in the Application Manager to display the Application Work Procedures Editor:

Work Procedures Extended Editor

2. Click on New.

3. Enter the name of the work procedure to call in the Work Procedure field.

4. Enter the parameter type in the Parameter Type field.

5. Enter the parameter (client_data) in the Parameter field

6. Click on Apply to add the work procedure.

All current work procedures are displayed in the scrolled window above these fields.

Removing a work procedure

To remove a work procedure:

1. Select the procedure from the list displayed in the Application Work Procedures Editor.

2. Click on Delete.

The procedure is removed from the list and from your application.

Timer Procedures

A timer procedure is a callback procedure that you register. A timer procedure is invoked by the Xt Intrinsics when the interval of time that you specified elapses. When a timeout event occurs, the Intrinsics invokes the timer callback procedure, and the Intrinsics automatically removes the callback. Timeout events are invoked only once.

When generating ViewKit code, Timers are implemented using the VkPeriodic class. VkPeriodic invokes the timer repeatedly until it is explicitly stopped.

Registering a timer procedure

Use a timer procedure for an event that you want to happen periodically, but not continuously. When the timer procedure is registered, Xt first waits for at least the interval you specified, and then calls the timer procedure.

Use the following function to register a timer procedure by hardcoding:

XtAppAddTimeOut(app_context, interval, proc, client_data)

and specify the interval of time that should elapse before this function is invoked. The interval of time is specified in milliseconds. After this interval elapses, the proc callback function is invoked by Xt Intrinsics. The client_dataparameter specifies client data passed to proc . XtAppAddTimeOut returns an ID that identifies the timer procedure.


Note: To call proc repeatedly, you must re-register the timeout within the proc procedure.

Application Timer Procedure Editor

To register a timer procedure using Builder Xcessory, click on the "..." button next to the Timer Procedures input field in the Application Manager to display the Application Timer Procedures Editor:

Application Timer Procedures Editor

Registering a new timer procedure

To register a new timer procedure:

1. Click on New.

2. Enter the name of the timer procedure to call after the interval expires in the Timer Proc Name field.

3. Enter the interval in the Interval field.

4. Enter the parameter type in the Parameter Type field.

5. Enter the parameter (data) in the Parameter field.

6. Click on Apply to register the timer procedure.

Current timer procedures are displayed in the window above these fields.

Removing a timer procedure

To remove a timer procedure:

1. Select the procedure from the list displayed in the Application Timer Procedures Editor.

2. Click on Delete.

The procedure is removed from the list and from your application.

The information you enter in the input fields is used to create the XtAppAddTimeOut function in the code generated from Builder Xcessory.

 

Documentation: