PtSetResources()

Set one or more resources for a widget

Synopsis:

int PtSetResources( PtWidget_t *widget,
                    int n_args,
                    PtArg_t const *args );

Library:

ph

Description:

This function sets resources for the specified widget. The args array indicates which resources to set, and n_args indicates the number of items in the args array. Before calling this function, you must initialize the args array with PtSetArg() or Pt_ARG().


Note: If you're setting only one resource, it's easier to call PtSetResource().

For more information, see the Manipulating Resources in Application Code chapter of the Photon Programmer's Guide.

If the widget has been realized, changing its resources may change how it appears on the screen.

Returns:

0
At least one of the given resources was applied to the widget.
-1
The widget wasn't modified because it doesn't contain the given resources or the values of the resources were the same as those already stored in the widget.

Note: A return code of 0 doesn't necessarily mean that all the resources were successfully set. The only way to be sure that a resource was set is to set it, then get it and compare the values.

Examples:

Turn the widget blue and highlight it:

PtArg_t args[2];
PtWidget_t *widget; 

PtSetArg( &args[0], Pt_ARG_FILL_COLOR, Pg_BLUE, 0 );
PtSetArg( &args[1], Pt_ARG_FLAGS, 
          Pt_HIGHLIGHTED, Pt_HIGHLIGHTED );
PtSetResources( widget, 2, args );

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PtArg_t, Pt_ARG(), PtGetResource(), PtGetResources(), PtSetArg(), PtSetResource()

Manipulating Resources in Application Code chapter of the Photon Programmer's Guide.