ApGetDBWidgetInfo()

Get information about a widget in a widget database

Synopsis:

ApDBWidgetInfo_t *ApGetDBWidgetInfo(
                     ApDBase_t const *dbase,
                     unsigned index,
                     ApDBWidgetInfo_t *info );

Arguments:

dbase
A pointer to a widget database that you opened with either ApOpenDBase() or ApOpenDBaseFile().
index
The index of the widget that you want to get information about. The index of the first widget is 0.
info
A pointer to a ApDBWidgetInfo_t structure that the function fills with information about the widget; see below.

Library:

Ap

Description:

This function extracts information about the widget with a given index in the database specified by dbase.

If index is greater than or equal to the number of widgets in the database, the function returns NULL. Otherwise, it puts information about a widget in the buffer pointed to by info, and returns info.

The ApDBWidgetInfo_t structure contains at least the following members:

const char *wgt_name
The widget's name.
const char *wgt_class
The name of the widget's class.
int parent_index
The index of the widget's parent in the database, or -1 if it has no parent.
int level
How deep in the hierarchy the widget is. The top level in the hierarchy is 1.

Returns:

The same pointer as info, or NULL if there isn't a widget with the given index.

Examples:

ApDBase_t *dbase = ApOpenDBase( ABM_db );

int i;
ApDBWidgetInfo_t wi;

for ( i=0; ApGetDBWidgetInfo( dbase, i, &wi ); ++i )
  printf( "#%d: '%s' is a %s, child of #%d, at level %d.\n",
          i, wi.wgt_name, wi.wgt_class, wi.parent_index,
          wi.level );

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

ApCloseDBase(), ApCreateDBWidget(), ApCreateDBWidgetFamily(), ApCreateWidget(), ApCreateWidgetFamily(), ApOpenDBase(), ApOpenDBaseFile(), ApSaveDBaseFile(),

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