Caution: This version of this document is no longer maintained. For the latest documentation, see


Retrieve one or more resource values for a widget


int PtGetResources( PtWidget_t *widget,
                    int n_args,
                    PtArg_t *args );




This function sets pointers to resource values within the specified widget. The args array indicates which resources are desired, and n_args indicates the number of items in the args array.

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

You must initialize the args array with PtSetArg() or Pt_ARG() before calling PtGetResources(). The Pt type of a resource determines how that resource should be set or queried. You use the Pt type when setting a resource entry with PtSetArg().

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

Caution: Because PtGetResources() returns pointers directly into the internals of the widget, don't modify those values directly. If you wish to retrieve the value of a given resource and then modify that value:
  1. Get the resource.
  2. Copy the resource to a temporary variable.
  3. Modify the temporary variable.
  4. Using the modified copy, set the resource.


An error occurred.


Determine a widget's color, and determine whether or not the widget is highlighted:

PtArg_t          args[2];
PgColor_t        *color;
unsigned long    *flags;
PtWidget_t       *widget;

PtSetArg( &args[0], Pt_ARG_FILL_COLOR, &color, 0 );
PtSetArg( &args[1], Pt_ARG_FLAGS, &flags, 0 );
PtGetResources( widget, 2, args );

printf( "Color: %08lx Highlighted: %s\n", *color, 
        *flags & Pt_HIGHLIGHTED ? "Yes":"No" );



Interrupt handler No
Signal handler No
Thread No

See also:

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

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