PtFindResource()

Find the record associated with a resource

Synopsis:

PtResourceRec_t const * PtFindResource(
    long type,
    PtWidgetClass_t const * const a_class );

Arguments:

type
The resource you want to find (e.g. Pt_ARG_COLOR).
a_class
The widget class to search.

Description:

This function finds the resource record for the resource given by type in the a_class class or any of its superclasses. You can use this function to detect whether a widget implements a particular resource or not, or in your own Set Resource/Get Resource methods.

Returns:

A pointer to a resource record, or NULL if no resource is found.

Examples:

my_label_setcolor( PtWidget_t *widget, PgColor_t color )
{
  const PtResourceRec_t *res_rec;
  PtArg_t argt;
  PtSetArg( &argt, Pt_ARG_COLOR, color, 0 );
  res_rec = PtFindResource( Pt_ARG_COLOR,
                                  PtLabel->wclass );
  PtSetValue( widget, res_rec, &argt );
}

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PtSetValue()