DIAdem Help

Object: D2AxisSystemDropContext

  • Updated2024-09-12
  • 2 minute(s) read

Object: D2AxisSystemDropContext

The D2AxisSystemDropContext object provides information about the comment onto which you dragged and dropped an object. Do not set the DoProceed property to TRUE if you change the number of curves in the associated event or if you execute similar operations.

Note  To test the example script, you must first save the script and register the script as a user command in the dialog box that opens when you select Settings»Extensions»User Commands.

The following example executes the user command MyOnDrop2DAxisSystemEvent when channels are dragged and dropped onto a 2D axis system. The user command displays the names of the channels that you dragged onto an object. The user command also displays information about the objects you dragged into the channels. The user command receives two parameters. The first parameter corresponds to a D2AxisSystemDropContext object and provides information about the 2D axis system onto which you dragged and dropped an object. The second parameter corresponds to a DropInformation object and provides information about the object which you dragged and dropped onto another object:

Call AddUserCommandToEvent("Report.Events.OnDrop2DAxisSystem", " MyOnDrop2DAxisSystemEvent")

Sub  MyOnDrop2DAxisSystemEvent(Context, DropContext)
  Dim oMyDropElement, sOutput, oMyAxis
  sOutput = "Names of dropped channels:"
  For Each oMyDropElement in DropContext.DiademElements
    sOutput = sOutput & VBCrLf & oMyDropElement.Name
  Next
  Call Msgbox(sOutput)
  Set oMyAxis = Context.AxisSystem
  If Context.CurveIndex>0 Then
    Call MsgBox(Context.Sheet.Name & VBCrLf & oMyAxis.Name & VBCrLf & oMyAxis.Curves2D.Item(Context.CurveIndex).Name)
  Else  
    Call MsgBox(Context.Sheet.Name & VBCrLf & oMyAxis.Name)
  End If  
  Context.DoProceed = TRUE
End Sub