Retrieve 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.
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.
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:
|
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" );
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
PtArg_t, Pt_ARG(), PtSetArg(), PtSetResources()
Manipulating Resources in Application Code chapter of the Photon Programmer's Guide.