IDMApplicationEvents interface should be used to
receive notifications from the DM2003 application object(s).
DM2003 supports multiple event sinks; following objects
may take part in the event processing:
| Kind | Name | ID | Description |
| OnCreateDocument | 1 | Fired when new DataForm created | |
| OnCloseDocument | 2 | Fired when DataForm closed | |
| OnCommand | 3 | Provide feedback from server to client | |
| OnLoadFile | 4 | Fired when disk file have been loaded into container | |
| OnQuit | 5 | Fired from MainForm.OnClose | |
| OnPlotClick | 6 | Plot point area clicked | |
| OnPlotPointClick | 7 | Plot point clicked | |
| OnPlotSelection | 8 | Plot selection changed | |
| OnPlotGetPoint | 9 | Returns point coordinates | |
| OnOpenFile | 10 | Used if data file dropped, reopened or opened from DDE and cmdline | |
| OnStart | 11 | Invoked when after all initialization |
| event OnCommand(Command): HResult |
OnCommand event handler fires when user invokes some action. The name of action passed in the Command parameter. This is the same name as used in IsCommandXXX properties and ExecuteCommand method. You can use this event to create "Macro recorder" applications or add something to the default action behavior. See also the list of standard action names.
| event OnQuit(SaveState): HResult |
OnQuit event has important feature: in the SaveState parameter it passes the state of "Save settings on exit" checkbox in the Application Properties Dialog.
| event OnPlotPointClick(Document, Point, Serie, Result): HResult |
Use this event if you want to do something when user clicks plot point (that is, mouse coordinates are inside some point). Notice that you can change default behavior of plot eraser and editor modes if you return false in this handler as shown in the example below (in case of several event handlers, their results are logically multiplied: Result1 and Result2 and ...)
function Server_OnPlotPointClick(Doc, Point, Serie) Server_OnPlotPointClick=not ((Doc is TempWnd) and (Serie<>1)) end function
Please note that the result returned to DM2003 core processed in some unclear and awkward manner due to limitations of JavaScript language (which does not allow ByRef parameters). There may be a lot of event handlers defined in various clients. All these handlers divided into following groups:
Inside first two groups, every attached handler is called (keep in mind that COM object may have several client references), and the results are logically summed (OR operator). This is because .Net clients are connected to the event sink for every event handler (delegate object), so the event called many times in the client and the most of calls return false (since there is no handler defined for this connection).
| event OnPlotGetPoint(Document, Point, Serie, X, Y, Result): HResult |
OnPlotGetPoint event allows you to display points whose coordinates calculated by your code. This is in contrast to usual mode, when plot point coordinates are stored in containers and possibly transformed by DM2003 application using axes and series expressions and embedded expression parser. To enable this feature for particular series, set IDMSerie3.EnableGetPointEvent property.
Server.CreateDocument Server.InstallPath & "samples\data_1.dat" Server.ExecuteCommand "ShowWorksheetAction" Server.ExecuteCommand "SelectAllAction" Server.ExecuteCommand "PlotLinesAction" Server.ExecuteCommand "ShowPlotAction" Server.ActiveDocument.Plot.CurrentSerie.EnableGetPointEvent=true ' Returns point coordinates function Server_OnPlotGetPoint(Doc, Point, Serie, ByRef X, ByRef Y) ' enter your code here Server_OnPlotGetPoint=true if x<100 then y=0.5 end function