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

ApOpenDBase(), ApOpenDBaseFile()

Open a module as a widget database

Synopsis:

#include <Ap.h>

ApDBase_t *ApOpenDBase( 
               ApEventLink_t const *link_callback );

ApDBase_t *ApOpenDBaseFile( char const *path );

Description:

These functions open a module as a widget database:

Typically, the module is a picture, but it can also be a window or dialog.


Note: Before calling ApOpenDBaseFile(), you should call ApAddClass() for each widget class that you'll likely encounter in the database. This will add the widget classes to the internal widget class table.

Returns:

A pointer to a PhAB picture database structure, or NULL for failure.

Examples:

ApDBase_t        *mydbase;
PtArg_t          args[2];

mydbase = ApOpenDBase( ABM_mypicture );

PtSetArg( &args[0], Pt_ARG_TEXT_STRING, 
          "This Widget", 0 );
ApCreateWidget( mydbase, "my_label_widget", 10, 10, 1, 
                args );

PtSetArg( &args[0], Pt_ARG_TEXT_STRING, 
          "That Widget", 0 );
PtSetArg( &args[1], Pt_ARG_FILL_COLOR, Pg_WHITE, 0 );
ApCreateWidget( mydbase, "my_label_widget", 10, 30, 2, 
                args );

ApCloseDBase( mydbase );

If the widget database is an external file, it can be opened using ApOpenDBaseFile() instead of ApOpenDBase():

mydbase = ApOpenDBaseFile( "mypicture.wgtp" );

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

ApAddClass(), ApCreateWidget(), ApCreateWidgetFamily()

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


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