ApCreateDBWidgetFamily()

Create a widget family by copying it from a PhAB widget database, specifying a parent

Synopsis:

#include <Ap.h>

PtWidget_t *ApCreateDBWidgetFamily(
               ApDBase_t const *db,
               char const *wgt_name,
               PtWidget_t *parent,
               PhPoint_t const *pos,
               int nargs,
               PtArg_t const *args );

Arguments:

db
A pointer to a widget database that you opened with either ApOpenDBase() or ApOpenDBaseFile().
wgt_name
The instance name of one of the widgets inside the database.
parent
The parent for the widget. If parent is NULL, the widget has no parent. (Contrast this with ApCreateWidgetFamily(), which makes the widget a child of the current default parent.)
pos
A pointer to a PhPoint_t structure that specifies the position of the widget when it's created. If pos is NULL, the widget's original position is used.
nargs and args
The standard resource argument counter and argument list (of type PtArg_t) used by PtCreateWidget().

Library:

Ap

Description:

This function creates widgets by copying a widget family from a PhAB widget database. This is very useful when you need to create many instances of the same widget family.


Note: Before loading widgets from an external database, you should call ApAddClass() for each widget class that you'll likely encounter in it. This will add the widget classes to the internal widget class table.

ApCreateDBWidgetFamily() creates the named widget and, for container class widgets, any children of the widget.


Note: The pointers of the widget's children aren't directly available using this function. If you need access to the container's children, you'll need to call ApCreateDBWidget() for the container and each widget inside it. If you create them in the same hierarchical order as defined in the database, the parent-child relationship will be maintained.


Note: If any of the widgets returned by this function contain images, the images reference data in the widget database. Therefore, don't close the widget database while you're using these widgets. If you need to close the database, you must remove all references to image data. You can do this by destroying the widgets, unsetting images in the widgets, or changing them into images that don't reference the database by using PiDuplicateImage() to copy the images from the database.

Returns:

A pointer to the widget created for wgt_name, or NULL on failure.

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

ApCloseDBase(), ApCreateDBWidget(), ApCreateWidget(), ApCreateWidgetFamily(), ApGetDBWidgetInfo(), ApOpenDBase(), ApOpenDBaseFile(), ApSaveDBaseFile(), PhPoint_t, PtArg_t, PtCreateWidget()

Accessing PhAB Modules from Code chapter of the Photon Programmer's Guide