PtSetArg()

Build argument lists for widgets

Synopsis:

PtSetArg( PtArg_t *arg,
          long type,
          long value,
          long len );

Library:

ph

Description:

This macro builds argument lists to be used with PtCreateWidget(), PtSetResources(), and PtGetResources().


Note:
  • If the values don't need to be calculated at runtime, you might be able to use Pt_ARG() instead to initialize the argument list.
  • A common mistake is to think that this macro actually sets the resources. It doesn't; be sure to call PtCreateWidget(), PtSetResources(), or PtGetResources().
  • If you're setting or getting one resource, it's easier to call PtSetResource() or PtGetResource().

The arg argument is normally part of an array of PtArg_t data structures. The type argument contains the resource manifest and value contains the value of the argument being passed. The way the len argument is used depends on the resource type.

For information on getting and setting resources, see the Manipulating Resources in Application Code chapter of the Photon Programmer's Guide.

Examples:

PtArg_t args[4];
PhPoint_t pos = { 100, 100 };

/* Position the widget at (100,100) */

PtSetArg( &args[0], Pt_ARG_POS, &pos, 0 );

/* Make its primary color blue; in this case, blue text */

PtSetArg( &args[1], Pt_ARG_COLOR, Pg_BLUE, 0 );

/* Set the string drawn with the widget */

PtSetArg( &args[2], Pt_ARG_TEXT_STRING, "Button", 0 );

/* Place the button widget in the widget hierarchy */

PtCreateWidget( PtButton, Pt_DEFAULT_PARENT, 3, args );

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PtArg_t, Pt_ARG(), PtCreateWidget(), PtGetResources(), PtSetResources()

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