ApCopyDBWidget()

Copy a widget from a PhAB widget database

Synopsis:

#include <Ap.h>

int ApCopyDBWidget( ApDBase_t const *from_dbase,
                    char const *from_name,
                    ApDBase_t *to_dbase,
                    char const *to_name );

Arguments:

from_dbase
A pointer to a PhAB widget database structure, returned by ApOpenDBase() or ApOpenDBaseFile(), for the database that you want to copy a widget from.
from_name
The name of the widget that you want to copy.
to_dbase
A pointer to a PhAB widget database structure for the database that you want to copy the widget to.
to_name
The name to use for the copy of the widget.

Library:

Ap

Description:

ApCopyDBWidget() copies a widget from one PhAB widget database to another. The from_name parameter indicates which widget to copy from the database, and to_name lets you rename the copy. Only one widget can be copied at a time. If you copy a container-class widget, only the container widget is copied, not its children.


Note: This function was previously called ApCopyWidget(). You should use the new name, although applications that use the old name will still work.

Returns:

0
Success.
-1
Failure.

Examples:

ApDBase_t *from_dbase, *to_dbase;

from_dbase = ApOpenDBaseFile( "/home/me/mydbase.wgtp" );
to_dbase   = ApOpenDBaseFile( "/home/joe/his_dbase.wgtp" );
ApCopyDBWidget( from_dbase, "my_icon", to_dbase, "his_icon" );
ApSaveDBaseFile( to_dbase, "/home/joe/his_dbase.wgtp" );

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

ApDeleteDBWidget(), ApOpenDBase(), ApOpenDBaseFile(), ApSaveDBaseFile()

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