IDMStrings Interface

Version: 2.0
Dispatch interface for DMStrings Object

GUID: {673A9FC4-9A0B-11D4-B2A4-FD6847C75367}

This interface includes methods and properties required to maintain strings collection. You may enumerate collection items in "for..each" cycle or using indexed Items property as well as add, delete, change or insert individual lines.

Members:
Kind Name ID Description
Items 0 Change selected item
ItemCount 1 Return items count
_NewEnum -4 Return enumerator object
InsertItem 2 Insert item into selected position
DeleteItem 3 Delete selected item
Clear 4 Clear all items
AddItem 5 Add new item and return its index
Text 6 Change Strings.Text

Syntax:
property Items[Index]: Variant

Applies to:
DMComboBox, DMContainer, DMDigitizerContainer, DMExpressionComboBox, DMIniFile, DMLabels, DMListBox, DMListItems, DMRegistry, DMStrings

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.

Syntax:
r/o property ItemCount: Long

Applies to:
DMContainer, DMDigitizerContainer, DMLabels, DMListItems, DMStrings

ItemCount property returns number of elements in the Items parameterized property. Items are indexed from 0 to ItemCount-1 as shown in the example.

Example:

for I=0 to MyObject.ItemCount-1
  S=MyObject.Items(I)
next

Syntax:
r/o property _NewEnum: Unknown

Applies to:
DMApplication, DMContainer, DMInternalApplication, DMLabels, DMListItems, DMNotes, DMPlot, DMStrings

This property returns so-called Enumerator Object. Do not use it explicitly. It is used internally in the "for each [item] in [object]" cycles. Every object that has this property may be enumerated in such a cycles. This is for your convenience.

Examples:

function EnumDocuments
dim S
  S=""
  for each Doc in Server
    S=S & Doc.WindowCaption & vbCrLf
  next
  EnumDocuments=S  
end function

function EnumNotes
dim S
  S=""
  for each Ss in Server.Notes
    S=S & Ss & vbCrLf
  next
  EnumNotes=S  
end function

function EnumSeries
dim S
  S=""
  for each Ser in Server.ActiveDocument.Plot
    S=S & Ser.Text & vbCrLf
  next
  EnumSeries=S  
end function

function EnumItems
dim S
  S=""
  for each D in Server.ActiveDocument.Container
    S=S & D(0) & vbCrLf
  next
  EnumItems=S  
end function

Syntax:
function InsertItem(Value, Index): VOID

Applies to:
DMContainer, DMDigitizerContainer, DMListItems, DMStrings

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.

Example:

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

Syntax:
function DeleteItem(Index): VOID

Applies to:
DMContainer, DMDigitizerContainer, DMLabels, DMListItems, DMStrings

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.

Syntax:
function Clear: VOID

Applies to:
B740X, DMContainer, DMDigitizer, DMDigitizerContainer, DMLabels, DMListItems, DMNotes, DMStrings, E712X, HP4191X

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.

Syntax:
function AddItem(Value): Long

Applies to:
DMContainer, DMDigitizerContainer, DMLabels, DMListItems, DMStrings

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.

Examples:

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

Syntax:
property Text: BSTR

Applies to:
B740X, DMComboBox, DMExpressionComboBox, DMFloatEdit, DMLabel, DMListBox, DMListItems, DMNotes, DMSerie, DMSpinEdit, DMStrings, E712X, HP4191X

For DMForms ActiveX controls (DMComboBox, DMExpressionComboBox, DMListBox, DMFloatEdit, DMSpinEdit) this property changes the text in the appropriate control.

For collection objects (DMListItems, DMStrings), this property represents the contents of the collection as a single block of text. Lines are separated by standard CRLF characters.

For DMNotes, this property also operates with the editor's data as a whole.

For DMSerie and DMLabel objects, Text is just a label.

For device driver ActiveX controls (HP4191X, B740X and E712X) this property should be used to read and write data from/to the device.