Query: xtsetvaluea
OS: hpux
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
XtSetValues() XtSetValues() Name XtSetValues - set widget resources from an argument list. Synopsis void XtSetValues(object, args, num_args) Widget object; ArgList args; Cardinal num_args; Inputs object Specifies the object whose resources are to be modified; may be of class Object or any subclass thereof. args Specifies an array of name/value pairs that name the resources to be set and specify their new values. num_args Specifies the number of elements in args. Description XtSetValues() sets the resources of object named in args to the values specified in args. Once these values are copied from args into the widget, the widget's set_values() methods are called which gives the widget an opportunity to check the new values for consistency, update private widget fields to reflect the new state of the resources, or even to undo some of the changes. The "Background" section below explains the details of this process. Usage XtSetValues() is the primary way for a user to modify widget resources of a widget once that widget has been created. See XtSetArg() for information on setting resource names and values into an ArgList. To set resources specified in a NULL-terminated variable-length argument list rather than an ArgList, use XtVaSetValues(). This is often a more convenient function to use because it does not require you to initialize an ArgList array. Note that not all widget resources may be set with XtSetValues(). Some may only be set when a widget is created, and others should be treated as read-only resources. The documentation for the particular widget should indicate which resources are not settable with XtSet- Values(). To query the values of named resources, use XtGetValues() or XtVaGetValues(). Example You can use XtSetValues() as follows to set widget resources: Arg args[10]; int i; XFontStruct *bold_font; Pixel bright_red; /* * set up an argument list, assuming we've already obtained * the font and the color from somewhere else. */ i = 0; XtSetArg(args[i], XtNlabel, "Quit"); i++; XtSetArg(args[i], XtNfont, bold_font); i++; XtSetArg(args[i], XtNforeground, bright_red); i++; /* set the values */ XtSetValues(s, args, i); Background XtSetValues() starts with the resources specified for the Object class fields and proceeds down the subclass chain to the object. At each stage, it replaces the object resource fields with any values specified in the argument list. XtSetValues() then calls the set_values() methods for the object in superclass-to-subclass order. If the object has any non-NULL set_values_hook() methods, these are called immedi- ately after the corresponding set_values() method. This procedure permits subclasses to set subpart data via XtSetValues(). (Note, though, that as of Release 4, this can be done directly from the set_values() method.) If the class of the object's parent is a subclass of constraintWidgetClass, XtSetValues() also updates the object's constraints. It starts with the constraint resources specified for constraintWidgetClass and proceeds down the subclass chain to the parent's class. At each stage, it replaces the constraint resource fields with any values specified in the argument list. It then calls the constraint set_val- ues() methods from constraintWidgetClass down to the parent's class. The constraint set_values() methods are called with widget arguments, as for all set_values() methods, not just the constraint records, so that they can make adjustments to the desired values based on full information about the widget. Any arguments specified that do not match a resource list entry are silently ignored. If the object is of a subclass of RectObj, XtSetValues() determines if a geometry request is needed by comparing the old object to the new object. If any geometry changes are required, XtSetValues() restores the original geometry and makes the request on behalf of the widget. If the geometry manager returns XtGeometryYes, XtSetValues() calls the object's resize() method. If the geometry manager returns XtGeome- tryDone, XtSetValues() continues, as the object's resize procedure should have been called by the geometry manager. If the geometry man- ager returns XtGeometryNo, XtSetValues() ignores the geometry request and continues. If the geometry manager returns XtGeometryAlmost, XtSetValues() calls the set_values_almost() method, which determines what should be done. XtSetValues() then repeats this process, decid- ing once more whether the geometry manager should be called. Finally, if any of the set_values() methods returned True, and the widget is realized, XtSetValues() causes the widget's expose procedure to be invoked by calling XClearArea() on the widget's window. Structures Arg is defined as follows: typedef struct { String name; XtArgVal value; } Arg, *ArgList; See Also XtGetValues(1), XtSetArg(1), XtVaGetValues(1), XtVaSetValues(1), set_values(4), set_values_almost(4), set_values_hook(4). Xt - Resource Management XtSetValues()