Create a widget
PtWidget_t *PtCreateWidget( PtWidgetClassRef_t *class, PtWidget_t *parent, unsigned n_args, PtArg_t const *args );
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.
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(). |
A pointer to the newly created widget, or NULL if an error occurs.
See PtClearWidget() and PtSetArg().
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
PtDestroyWidget(), PtGetParentWidget(), PtReParentWidget(), PtSetArg(), PtSetParentWidget(), PtWidgetParent()
"Creating widgets" in the Creating Widgets in Application Code chapter of the Photon Programmer's Guide