[Previous] [Contents] [Index] [Next]

PtCreateWidget()

Create a widget

Synopsis:

PtWidget_t *PtCreateWidget( 
                PtWidgetClassRef_t *class,
                PtWidget_t *parent,
                unsigned n_args,
                PtArg_t const *args );

Description:

This function creates a widget in the current widget hierarchy. The class argument points to the desired widget class and the parent argument points to the desired parent widget. If you set parent to NULL, the default parent, which is the most recently created container, will be used.

The n_args argument contains the number of arguments being passed to the widget library and the args argument points to an array containing n_args arguments.

Since this function modifies and allocates only local data structures, it doesn't result in any interaction with the Photon Manager. The user doesn't see the widget until it's realized.


Note: Widgets that belong to the PtContainer class become the current parent widget when created. If you're creating multiple PtContainer-class widgets, make sure each one is placed in the correct container. To do this, either specify the desired parent in parent or call PtSetParentWidget().

Returns:

A pointer to the newly created widget, or NULL if an error occurs.

Examples:

See PtClearWidget() and PtSetArg().

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PtDestroyWidget(), PtGetParentWidget(), PtReParentWidget(), PtSetArg(), PtSetParentWidget(), PtWidgetParent()

"Creating widgets" in the Creating Widgets in Application Code chapter of the Photon Programmer's Guide


[Previous] [Contents] [Index] [Next]