3.3 DM_BindCallBacks
After having loaded the dialog a table of functions can be passed on to DM by means of this function. By using this table the DM then calls the functions indicated in the dialog.
DM_Boolean DML_default DM_EXPORT DM_BindCallBacks
(
DM_FuncMap funcmap,
DM_UInt funccount,
DM_ID dialogID,
DM_Options options
)
Parameters
This parameter is the table of functions which can be called directly by DM. The structure of this table is described in the chapter on data structures.
-> DM_UInt funccount
This parameter indicates the size of the transferred function tables.
-> DM_ID dialogID
This parameter is the ID of the dialog for which this function table is to be valid. You have received this ID from the function DM_LoadDialog as return value.
-> DM_Options options
Here the following options are possible:
Option |
Meaning |
---|---|
This option means that no error messages are to be output to the user. Otherwise a difference between superfluous functions and missing functions will be made. |
|
This option means that error messages are to be output to the user. |
Example
A table with three functions is to be transferred to DM.
In order to initialize the function table with the addresses of these functions, these functions have to be declared at least before the table definition.
Declaration in the Header File
DM_boolean DML_c DM_ENTRY ReadZip __((DM_String));
char* DML_c DM_ENTRY QueryZip __((DM_String));
DM_boolean DML_c DM_ENTRY WriteFile __((DM_String, DM_String,
DM_String));
Definition of the Table in the C Program
#define FuncCount (sizeof(FuncMap)/ sizeof(FuncMap[0]))
static DM_FuncMap far FuncMap[ ] = {
{ "ReadZip", (DM_EntryFunc) ReadZip},
{ "QueryZip", (DM_EntryFunc) QueryZip},
{ "WriteFile", (DM_EntryFunc) WriteFile},
};
/* Install table of application functions */
{
if (!DM_BindCallBacks(FuncMap, FuncCount, dialogID, 0))
DM_TraceMessage ("There are some functions missing.", 0);
return 0;
}