IDMLabels Interface

Version: 2.1
Dispatch interface for DMLabels Object

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

This interface provides access to the collection (dynamic array) of plot label objects. You may create, delete, enumerate and reorder labels using methods and properties of this collection. In addition, IDMLabels interface has SelectedItem property that returns reference to the selected label object.

Members:
Kind Name ID Description
Items 0 Changes selected label
ItemCount 1 Returns number of labels
SelectedItem 2 Returns selected label (if any)
_NewEnum -4 Returns enumerator object
Clear 3 Clears all labels
AddItem 4 Returns new label object
DeleteItem 5 Deletes label
SendToBack 6 Makes the label beneath others
BringToFront 7 Makes the label topmost

Syntax:
r/o property Items[Index]: IDispatch

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 SelectedItem: IDispatch

Applies to:
DMLabels

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 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: IDispatch

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:
function DeleteItem(Value): 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 SendToBack(Value): VOID

Applies to:
DMLabel, DMLabels, DMSerie

SendToBack method moves given object to the first position in the collection, so it is painted before other objects.

Syntax:
function BringToFront(Value): VOID

Applies to:
DMLabel, DMLabels, DMSerie

BringToFront method moves given object to the last position in the collection, so it is painted after other objects.