Previous Next Up Title Contents Index Functions Index Top Library

1.9.3. ANIMATION

A number of problems are involved with producing animated graphics in a MOTIF program. When the program is in the Mainloop the only way of obtaining animation is is by looping in a callback, but then the mainloop is no longer active and the user is held up until the end of the animation.

Until the animation loop has finished running the MainLoop is not in control and cannot therefore process the events X.

The GPHIGS widget offers a specialized function, called GPHIGS_ANIM_CB, which solves this problem.

This function is called in a callback.

Example using a pushButton to activate animation :

XtAddCallBack(w, XmNactivateCallback, GPHIGS_ANIM_CB, fctUser)

w is the pushButton widget

XmNactivateCallback is the name of the push button callback

fctUser is the user animation function

This function (fctUser) will only produce a single-frame animation.

The first time the pushbutton is pressed animation is activated, the second time it is deactivated. This operation may be repeated as many times as required.


Previous Next Up Title Contents Index Functions Index Top Library