3.12 DM_CreateObject
Any object or model within a dialog can be created with this function. The first parameter describes the type of the object (pushbutton, window, etc.), the second parameter describes the type of the object parent, and the last parameter describes the scope (object/model) of the new object.
DM_ID DML_default DM_EXPORT DM_CreateObject
(
DM_ID classtagOrModel,
DM_ID parentID,
DM_Options options
)
Parameters
-> DM_ID classtagOrModel
This parameter describes the type of the new object. The necessary definitions are included in IDMuser.h.
The following definitions are accepted:
- DM_ClassCanvas
- DM_ClassCheck
- DM_ClassEditext
- DM_ClassGroupbox
- DM_ClassImage
- DM_ClassImport
- DM_ClassListbox
- DM_ClassMenubox
- DM_ClassMenuitem
- DM_ClassMenusep
- DM_ClassMessagebox
- DM_ClassModule
- DM_ClassNotebook
- DM_ClassNotepage
- DM_ClassPoptext
- DM_ClassPush
- DM_ClassRadio
- DM_ClassRecord
- DM_ClassRect
- DM_ClassScroll
- DM_ClassStatext
- DM_ClassTablefield
- DM_ClassTimer
- DM_ClassWindow
-> DM_ID parentID
Parent of the object to be newly generated.
-> DM_Options options
For these functions different options are possible which can be indicated in connection with an "or" (|).
Option |
Meaning |
---|---|
If this option is set, a new model is to be created by means of this function. |
|
If this option is set, the object to be newly generated is to be created independently of the definition in the specified model. |
|
This option has to be set if a DM_ID of a model is indicated in the parameter classtagOrModel. In doing so, the function will know that a new instance has to be generated from this model. If it is a hierachical model, also its children will be created in the new object. |
Return Value
ID!=0 |
Object was successfully created. |
ID=0 |
Object could not be created. |
Example
A new instance of a window model is to be generated out of a C function.
void DML_default DM_ENTRY CreateNewInstance
(
DM_ID Modell,
DM_ID DialogID
)
{
DM_ID NewObject;
DM_Value data;
if ((NewObject = DM_CreateObject (Modell, DialogID,
DMF_InheritFromModel | DMF_CreateInvisible) != (DM_ID) 0)
{
/* Setting the data in a newly generated window */
/* Finally making windows invisible */
data.type = DT_boolean;
data.value.boolean = TRUE;
DM_SetValue(NewObject, AT_visible, 0, &data, 0);
}
}
See Also
Built-in function create() in manual “Rule Language”
Method :create()