Open an external module file as a widget database
#include <Ap.h> ApDBase_t *ApOpenDBaseFile( char const *path );
Ap
ApOpenDBaseFile() opens an external module file as a widget database. Typically, the module is a picture, but it can also be a window or dialog. External module files supported have a .wgtp, .wgti, .wgtd, or .wgtw extension.
ApOpenDBase() opens the module specified by a ABM_ internal link manifest that's generated by PhAB.
Before calling ApOpenDBaseFile(), you should call ApAddClass() for each widget class that you'll likely encounter in the database. This function adds the widget classes to the internal widget class table. |
Note that this function associates the widget database with the current PhAB context. Only language translations from that context are applied when you create widgets using the database. If you don't want any language translations to be applied to an external database, set the current context to NULL when you open the database:
ApSetContext( NULL ); ApDBase_t *db = ApOpenDBaseFile( fname ); ApSetContext( & AbContext ); // Restore the program's // context
A typical PhAB application has only one PhAB context; only applications that load PhAB-created DLLs have to deal with multiple contexts. For more information about creating DLLs from PhAB applications, see “Making a DLL out of a PhAB application” in the Generating, Compiling, and Running Code chapter of the Photon Programmer's Guide.
A pointer to a PhAB picture database structure, or NULL for failure.
ApDBase_t *mydbase; PtArg_t args[2]; /* Add the widget classes that are in the database to the internal table. */ ApAddClass ("PtLabel", &PtLabel); mydbase = ApOpenDBaseFile( "mypicture.wgtp" ); 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 );
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
ApAddClass(), ApCreateDBWidget(), ApCreateDBWidgetFamily(), ApCreateWidget(), ApCreateWidgetFamily(), ApGetDBWidgetInfo(), ApCloseDBase(), ApOpenDBase()
Accessing PhAB Modules from Code chapter of the Photon Programmer's Guide