Next: Set Resource at Creation Up: Overriding Resource Defaults Previous: .Xdefaults file

Dymanic Control

We can change the values of a resource from within a program. This can occur at any time in the program i.e. we change values dynamically.

Two functions XtSetArg() and XtSetValues() do this.

We use XtSetArg() to place resource values in an Argument list.

XtSetValues() then sets the values for a given widget.

In push_res1.c we use XtSetArg() to set width and height values in the arg list:

Arg args[10]; /* Arg array */
int n = 0; /* number arguments */

XtSetArg(args[n], XmNwidth, 500);
XtSetArg(args[n], XmNwidth, 750);

The call XtSetValues(button, args, n) then sets these for the button widget.

A function XtGetValues() exists to find out resource values.
Tue May 24 16:52:56 BST 1994