IDMDocument2 Interface

Version: 2.0
Dispatch interface for DMDocument Object

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

This interface provides access to the document window properties. In particular, it includes references to the data container, worksheet and plot objects. Use its members to display and manipulate data.

Members:
Kind Name ID Description
WindowCaption 1 Change DataForm.Caption
WindowState 2 Change DataForm.ViewState
Container 3 Return IDMContainer
Worksheet 4 Return IDMWorksheet
Plot 5 Return IDMPlot
IsRecording 6 Change DataForm.Recording
Activate 7 Activate window and restore if minimized
Close 8 Close window
SaveUndoInfo 9 Save Undo Information
WindowSize 101 Change DataForm.WindowState
CanUndo 102 True if undo is possible
Undo 103 Undo last operation
Clone 104 Make a copy of the data window
SaveUndo 105 Save undo information and operation name

Syntax:
property WindowCaption: BSTR

Applies to:
DMDocument

Changes window title (or caption). Don't mix window caption and the file name, associated with data container object!

Syntax:
property WindowState: User_Defined

Applies to:
DMDocument

This property controls window view. It can have one of the values listed in the WindowStates enumeration. Do not mix this property with WindowSize that reflects "size" state!

Syntax:
r/o property Container: IDispatch

Applies to:
DMDigitizer, DMDocument, DMSerie

For DMDocument and DMSerie objects, Container property returns reference to the associated DMContainer object. Notice that for DMSerie object, this property is read/write, that is, you can assign to it container of any document.

For DMDigitizer, this property returns reference to the DMDigitizerContainer object, which is used only to store points coordinates.

Syntax:
r/o property Worksheet: IDispatch

Applies to:
DMDocument

Returns reference to the DMWorksheet object.

Syntax:
r/o property Plot: IDispatch

Applies to:
DMDocument

Returns reference to the DMPlot object.

Syntax:
property IsRecording: Boolean

Applies to:
DMDocument, DMSerie

For DMDocument, this property indicates whether appropriate data window is in the "recording" state, that is, used for recording data from the measurement system (or for another real-time data streaming). Such window has a thick colored frame. Besides, "recording" data window is not only a visual feedback - it doesn't refresh plot when you set Container.Modified=true, and doesn't refresh Series Manager when you set Container.Modified=false (although worksheet updates its size). This feature should be used to eliminate flickers and significantly increase data streaming rates (and reduce CPU load). In addition, value of this property analyzed in the IDMApplication.RecordPoint() method.

For DMSerie, this property reflects the fact that this series is used to display accumulated data. When it is set to True, a little cross is displayed at the last point. Set IsRecording property to indicate that you are adding points into this series.

Syntax:
function Activate: VOID

Applies to:
DMDocument, DMSerie

Only one of MDI child windows may be active, that is, has input focus. For DMDocument, this procedure makes document window active. Note that activation can change index of document in the Documents property.

For DMSerie object, Activate just makes this series active, or current, by changing IDMPlot.SerieIndex property. Of course, its position in the Series array does not change.

Examples:

' DMDocument:
dim Doc
set Doc=Server.Documents(1)
Doc.Activate
' DMSerie:
Server.ActiveDocument.Plot.Series(2).Activate

Syntax:
function Close: VOID

Applies to:
CoCPortLib2, CPortLibX2, DMAppHelper, DMApplication, DMClientSocket, DMComPort, DMComTerminal, DMDLLHelper, DMDocument, DMIEEE488Port, DMInternalApplication

For DMDocument, this procedure closes document window. It is similar to Window|Close menu command.

For DMIEEE488Port, DMClientSocket, DMComPort and DMComTerminal, Close method closes the appropriate communication port.

DMDLLHelper.Close unloads DLL so that all subsequent API calls become impossible. DMAppHelper.Close also clears internal reference to DM2003 DOM. It is recommended to close these objects after use.

DMApplication.Close should be invoked to terminate DM2003. Unlike executing ExitAction, it does not display COM server warning for external (out of process) servers. For example, you may place following code in the HTML page loaded into the separate instance of MSIE browser:

Example:

sub Btn_onclick
dim app
  set app=CreateObject("DM.DMApplication")
  ' do something useful...
    . . . . .
  ' wrong - does not avoid COM warning message:
  'app.ExecuteCommand "ExitAction"
  ' right - nothing displayed if no unsaved data:
  app.Close
  set app=Nothing
end sub

Syntax:
function SaveUndoInfo: VOID

Applies to:
DMDocument

This method implemented only for backward compatibility with DM2000. Use SaveUndo() method instead, since it allows you to indicate which operation have modified data.

Syntax:
property WindowSize: User_Defined

Applies to:
DMDocument

This property controls window size. It can have one of the values listed in the WindowSizes enumeration. Do not mix this property with WindowState that reflects "view" state!

Syntax:
function CanUndo: Boolean

Applies to:
DMDocument, DMNotes

This method returns True if Undo operation for given object is possible. Use it to monitor controls associated with the "Undo" command.

Syntax:
function Undo: VOID

Applies to:
DMDocument, DMNotes

Performs Undo operation for the given object, that is, restore data to the previous state.

For DMDocument object, you should explicitly copy undo information using the SaveUndo() method before you start to change data in the container. Keep in mind that this method restores only data, so that, series ranges may change if you, for example, delete some lines.

Syntax:
function Clone(Data): IDispatch

Applies to:
DMDocument

Makes a copy of the selected data window and returns reference to its DMDocument object. If Data parameter is false, Container's data will not be copied into new window.

Syntax:
function SaveUndo(Operation): VOID

Applies to:
DMDocument

This method simply copies contents of data container into another container - Undo Buffer. It is recommended that you will call SaveUndo before any data changes, especially if you modify a range of lines simultaneously. Operation parameter will be displayed in the statusline hint for the "Undo" command.