6.8.10 DMcob_CreateObject

This function can be used to create an object of any object class as instance or model.

The parameters define the object class (pushbutton, window, etc.), the parent, and the object type (instance or model) of the newly created object.

77  DM-objectid  pic 9(9)  binary value 0.
77  DM-parentid  pic 9(9)  binary value 0.
77  DM-classid   pic X(2)  value "??".

call "DMcob_CreateObject" using
            DM-StdArgs
            DM-objectid
            DM-parentid
            DM-classid.

Parameters

-> DM-Options of DM-StdArgs

Folgende Optionen können angegeben werden, wobei mehrere Optionen mit oder verknüpft werden können:

Option

Meaning

0

Creates an instance.

DMF-CreateModel

Creates a model.

DMF-CreateInvisible

The newly generated object is created invisible, regardless of the setting at its Default.

DMF-InheritFromModel

This option was intended to create an object which was based on the Model specified in the classid parameter.

However, DMF_InheritFromModel should not be used.

Instead, objects derived from a model should be created using the DMcob_CreateFromModel function.

<- DM-objectid

In this parameter, the identifier of the newly created object is returned.

-> DM-parentid

This parameter defines the parent of the newly created object.

-> DM-classid

This parameter determines the class of the new object. All class definition constants are contained in the IDMcobws.cob file that comes with the IDM.

Value range

  • DM-Class-Application
  • DM-Class-Canvas
  • DM-Class-Check (Checkbox)
  • DM-Class-Doccursor
  • DM-Class-Document
  • DM-Class-Editext (Edittext)
  • DM-Class-Filereq
  • DM-Class-Groupbox
  • DM-Class-Image
  • DM-Class-Layoutbox
  • DM-Class-Listbox
  • DM-Class-Mapping
  • DM-Class-Menubox
  • DM-Class-Menuitem
  • DM-Class-Menusep
  • DM-Class-Messagebox
  • DM-Class-Notebook
  • DM-Class-Notepage
  • DM-Class-Poptext
  • DM-Class-Progressbar
  • DM-Class-Push (Pushbutton)
  • DM-Class-Radio (Radiobutton)
  • DM-Class-Record
  • DM-Class-Rect (Rectangle)
  • DM-Class-Scroll (Scrollbar)
  • DM-Class-Spinbox
  • DM-Class-Splitbox
  • DM-Class-Statext (Statictext)
  • DM-Class-Statusbar
  • DM-Class-Tablefield
  • DM-Class-Timer
  • DM-Class-Toolbar
  • DM-Class-Transformer
  • DM-Class-Treeview
  • DM-Class-Window

Return value

DM-status of DM-StdArgs

DM-error

Object could not be created.

DM-success

Object was successfully created.

Example

Creating a new window.

Call "DMcob_CreateObject" using DM-StdArgs
    DM-newobject DM-dialogID DM-CLass-Window.

See also

Function DMcob_CreateFromModel

Built-in function create() in manual “Rule Language”

Method :create()