6.3 Class DM_Record
This class comprises all the functions which are necessary to attach a record with functions on the dialog side to a C++ class, or its instances (examples of the class). Some of the functions mentioned here are generated only by the code generator, e.g. DM_Record::call().
6.3.1 DM_Record() (Constructor)
In addition to the default constructor it allows for the direct attribution of the class instance to an IDM object.
DM_Record ( DM_ID newId = (DM_ID)0 )
Parameters
-> DM_ID newId
Object ID which is then influenced by the other class methods.
Return value
None.
Exceptions
None.
See also
Class DM_Object, DM_Record::id(), DM_Record::connect()
6.3.2 id()
This function transfers the correlation to another IDM object.
void id
(
DM_ID newId
)
Parameters
-> DM_ID newId
Object ID which is then influenced by the other class methods.
Return value
None.
Exceptions
None.
See also
DM_Object::id(), Class DM_Object
6.3.3 getRecInfo()
This function is exclusively reserved for the IDM. It should not be called by the application programmer.
6.3.4 connect()
This function connects the instance of a C++-class with the record object on the dialog side which allows methods to be invoked from the dialog. In addition, the transferring back of values that are set on the C++-side is also made possible through this function.
Before this can take place the class must be linked by means of DM_Record::bind(), and with DM_Record::id() a assignment must be set to the record object. Afterward, one can either call functions on the dialog side or use the methods DM_Record::get() and DM_Record::put() on the C++ side for retrieving and setting the record structure values.
Please remember that the structure of the C++ class is identical to the record. Otherwise, you will encounter errors when calling methods and transferring the record structure values.
DM_Boolean connect
(
)
Parameters
None.
Return value
DM_TRUE |
when the C++ instance has been successfully connected with the dialog record |
DM_FALSE |
in case of error |
Exceptions
None.
See also
Functions DM_BindClass, DM_ConnectClass
DM_Record::bind(), DM_Record::disconnect(), DM_Record::get(), DM_Record::id(), DM_Record::put()
6.3.5 disconnect()
This function interrupts the connection between the C++ class instance and record on the dialog side. After this has been carried out it is no longer possible to invoke methods from the dialog side. Therefore, the dynamic deletion of the class instance is also disconnected if the record on the dialog side is destroyed.
DM_Boolean disconnect
(
)
Parameters
None.
Return value
DM_TRUE |
disconnection was successful |
DM_FALSE |
error |
Exceptions
None.
See also
6.3.6 get()
This function transfers the attribute values of the connected record on the dialog side into the structure of the class instance on the C++ side.
The transfer is carried out through the IDM when calling up a record function from the dialog side.
void get
(
)
Parameters
None.
Return value
None.
Exceptions
DM_Exception |
Function could not be executed without error. |
See also
DM_Record::connect(), DM_Record::put()
6.3.7 put()
This function transfers the structure values of the C++ class instance into the attributes of the connected record on the dialog side.
During the calling of a record function from the dialog side the IDM executes the transfer.
void put
(
)
Parameters
None.
Return value
None.
Exceptions
DM_Exception |
Function could not be executed without error. |
See also
Record::connect(), DM_Record::put()
6.3.8 bind()
This function binds a C++ class to a record on the dialog side. Through this the Dialog Manager is provided with all the necessary information needed in order to create instances of this C++ class, to delete them or to invoke methods.
This function should be called before starting the dialog (which normally happens with DM_StartDialog()) in order to ensure that all static records are connected with C++ instances.
DM_Boolean bind
(
DM_ID parentId,
DM_String path
)
Parameters
-> DM_ID parentId
Parent, e.g. dialog or module which contains the record with functions
-> DM_String path
Unambiguous path or identifier in order to identify the record with functions.
Return value
DM_TRUE |
connection was successful |
DM_FALSE |
error occurred |
Exceptions
None.
Example
For a dialog that defines a record Rec
with the function F
, the attachment of the class can look like the following:
@@@:INCLUDE@@@
@@@:CLASS/Rec@@@
@@@:IMPL/Rec@@@
//now implement the method F
DM_Integer Rec::F(DM_String S)
{
return strlen(A) + strlen(S) + B;
}
...
int DML_c DM_CALLBACK AppMain(int argc, char **argv)
{
DM_ID dialogID;
DM_Initialize(&argc, argv);
dialogID = DM_LoadDialog("dialog.dlg", 0);
Rec::bind(dialogID, "Rec");
DM_StartDialog(dialogID, 0);
DM_EventLoop(0);
return 0;
}
See also
Function DM_ConnectClass
6.3.9 call()
This function is strictly reserved for the IDM and should not be called by the application programmer. It serves for the dynamic creation and deletion of class instances and for the calling up of methods from the side of the dialog manager.