IDMContainer interface implemented only for
backward compatibility with DM2000. Use IDMContainer2 interface instead.
| Kind | Name | ID | Description |
| ItemCount | 1 | Return Items.Count | |
| Items | 2 | Change Items[I] | |
| Strings | 3 | Change Items[I].Data | |
| AddItem | 4 | Add new item initialized with array of numbers | |
| InsertItem | 5 | Insert new item initialized with array of numbers | |
| DeleteItem | 6 | Delete Item | |
| Clear | 7 | Delete all items | |
| Load | 8 | Load data from file | |
| Save | 9 | Save data to file | |
| FileName | 10 | Return FileName | |
| Modified | 11 | Change Modified flag |
| r/o property ItemCount: Long |
ItemCount property returns number of elements in the Items parameterized property. Items are indexed from 0 to ItemCount-1 as shown in the example.
for I=0 to MyObject.ItemCount-1 S=MyObject.Items(I) next
| property Items[Index]: Variant |
For DMINIFile, Items return either collection of INI file sections (if no section was defined in the Open method) OR the collection of names of records in the selected section. Use Value() property to access section contents (or Value) of the selected record. For DMRegistry, Items return the collection of names of the records (values) under the selected registry key.
Items collection filled in the Open method and is read-only. Don't try to change it anyway. Use Value() property to change values.
For DMComboBox, DMExpressionComboBox and DMListBox, Items represent a read/write collection of strings in the appropriate control.
For DMContainer and DMDigitizerContainer, Items is a parameterized property - an array of data items ("for each" cycle still can be performed on the object itself). Each data item is a variant array of double-precision numbers. Notice that for DMDigitizerContainer, you can only read Items. For DMContainer, you may assign either variant array OR just a properly formatted string to the Items() property.
For DMListItems and DMStrings, Items is a parameterized property that returns (or changes) a string selected by Index parameter (0..ItemCount-1).
For DMLabels collection, this is a default, parameterized (0..ItemCount-1) property that returns references to the DMLabel objects.
| r/o property Strings[Index]: BSTR |
While Items() parameterized property always return elements as variant arrays, in some cases it may be preferred to get string representation of data element. However, values will be rounded that may cause precision losses.
| function AddItem(Values): VOID |
AddItem method adds Value(s) element to the end of Items array (parameterized property). Note: for DMDigitizerContainer, this method is not implemented.
For DMLabels collection, it returns reference to the newly created DMLabel object.
Keep in mind that for DMContainer, you should set Modified property manually after you add container items. This will update all associated visual objects.
set D=Server.CreateDocument("")
for I=1 to 100
D.Container.AddItem(I & " " & I^2)
next
D.Container.Modified=true ' false also works
dim i, doc, ar(0,300)
'dim i, doc, ar(0) both commented and uncommented are ok!
set doc=DM2003.CreateDocument("")
for i=0 to 300
ar(0,i)=i
' ar(0)=i
' doc.Container.AddItem(ar)
next
doc.Container.AddItem(ar) ' many lines at once
doc.Worksheet.Refresh
' text version (JS-compatible)
dim i, doc, str
set doc=DM2003.CreateDocument("")
for i=0 to 300
str=str & i & vbCrLf
next
doc.Container.AddItem(str)
doc.Worksheet.Refresh
| function InsertItem(Position, Values): VOID |
InsertItem method for collections (DMListItems and DMStrings) inserts Value in the Items array (parameterized property) at the position given by the Index parameter (0..ItemCount-1). To add element to the begin of Items array, you should pass Index=0. For DMContainer, this method inserts Values (variant array or string) in the selected Position of the Items array. For DMDigitizerContainer, this method is not implemented.
Note: for DMContainer, you should set Modified property manually after you insert container items. This will update all associated visual objects.
dim A(1)
set D=Server.CreateDocument("")
for I=1 to 100
A(0)=I
A(1)=I^2
call D.Container.InsertItem(0, A)
next
D.Container.Modified=true
| function DeleteItem(Position): VOID |
Deletes item in in the appropriate Items array (collection or parameterized property) at the position given by the Index (or Position) parameter (0..ItemCount-1).
Note: for DMContainer, you should set Modified property manually after you delete container items. This will update all associated visual objects.
| function Clear: VOID |
For DMContainer and DMDigitizerContainer objects, Clear method empties the container and set Modified property to True.
For DMDigitizer, this method clears digitizer picture.
For DMListItems, DMNotes and DMStrings Clear also empties the contents of the appropriate Items (or Lines) arrays.
For HP4191X, B740X and E712X this method initialize appropriate device into some predefined state.
For DMLabels, this method deletes all plot labels.
| function Load(FileName): VOID |
Load method allows you to load data from the disk file into the object. For DMContainer, text-type (ASCII) file must contain values separated by commas, tabstops or spaces. For DMDigitizerContainer, however, this method not supported. As of build #415, compressed data format (binary) was added.
DMDigitizer.Load should be used to load picture into the digitizer. DMNotes.Load just loads text into the Notes editor. DMLabel uses Load() member to copy images in various formats (ico, bmp, jpg, gif, png) into the metafile.
For DMContainer, DMLabel and DMNotes objects, this method also can handle HTTP and FTP URLs, so that you can download files located on the Internet/Intranet.
| function Save(FileName): VOID |
Saves object's data to the selected disk file.
For DMContainer, values are separated by spaces, each item take a separate line. Modified property automatically cleared. In the DMDigitizerContainer object this method not implemented. As of build #415, compressed data format (binary) may be used - it depends on CompressDataFiles application option.
DMNotes object just writes editor's text to the disk. DMPlot object saves itself as a metafile picture.
| r/o property FileName: BSTR |
Returns full name of loaded file. Note that Load() and Save() methods implicitly modify this property. If file still not loaded, this property returns empty string.
MsgBox Server.Notes.FileName MsgBox Server.ActiveDocument.Container.FileName
| property Modified: Boolean |
This property used to track data modifications.
For DMContainer, when data implicitly modified by some method or you directly set this property, object fires internal event which will correctly update all worksheets and plots referenced this container. It takes a lot of calculations and painting job so don't change this property too frequently.
Notice: when you set Modified=true, and appropriate document window is in "recording" state, plot is not forced to refresh. This feature allows you to refresh worksheet (actually you must set Modified in order to update number of lines in the worksheet!) without repainting whole plot.
You can additionally reduce painting if you set Modified=false while Document.IsRecordind=true. In this case, only worksheet size will be updated. This mode can significantly increase the rate of data streaming.
For DMNotes, this property indicates whether editor text is modified or not. For DMDigitizerContainer this property is not implemented.