Object: ToolTip2DAxisContext
- Updated2024-09-12
- 3 minute(s) read
DIAdem REPORT > Objects > Context Objects > Object: ToolTip2DAxisContext
Object: ToolTip2DAxisContext
The ToolTip2DAxisContext object provides information on a 2D axis system in DIAdem REPORT when DIAdem calls the event assigned to the OnAxisSystem2D for ToolTipEvents property. DIAdem calls this event if you press the shift key and move the mouse over a REPORT object.
![]() | Note To test the example script, you must first save the second script and register it as a user command in the dialog box that opens when you select Settings»Extensions»User Commands. |
The following example creates a 2D axis system and assigns the user command MyToolTipEvent to the OnAxisSystem2D for ToolTipEvents property:
Dim oMy2DAxisSystem, oMyPos, oMy2DCurve Call Report.NewLayout() Call Data.Root.Clear() Call DataFileLoad(DataReadPath & "Report_Data.tdm","TDM","") Set oMy2DAxisSystem = Report.ActiveSheet.Objects.Add(eReportObject2DAxisSystem, "My2DAxisSystem") Set oMyPos = oMy2DAxisSystem.Position.ByCoordinate oMyPos.X1 = 20 oMyPos.X2 = 80 oMyPos.Y1 = 20 oMyPos.Y2 = 80 Set oMy2DCurve = oMy2DaxisSystem.Curves2D.Add(e2DShapeLine, "My2DCurve") oMy2DCurve.Shape.XChannel.Reference = "[6]/[1]" oMy2DCurve.Shape.YChannel.Reference = "[6]/[4]" 'This event will be raised if the mouse is moved AND the shift key pressed Report.Events.ToolTip.OnAxisSystem2D = "MyToolTipEvent" Call Report.Refresh()
If you press shift and move the mouse over the axis system, the user command determines the position of the mouse. The example calculates the coordinate of the nearest curve point from the mouse position and adds this to the default tooltip. If the mouse is not on a curve, the example displays the name and the type of the subobject over which you idle the mouse. The user command receives two parameters. The first parameter corresponds with the ToolTip2DAxisContext object and provides the information about the 2D axis system in DIAdem REPORT when you press the shift key and move the mouse over the 2D axis system. The second parameter is a text and corresponds with the tooltip for display:
Sub MyToolTipEvent(Context,ToolTipText) Dim oSystem, oCurve, x, y, oXAxis, oYAxis, oPoint, oChannel, oSubObject If Context.SubObject.Type = e2DElementCurve then Set oSystem = Context.AxisSystem2D 'Find curve, x and y-axis to convert the coordinate to value Set oXAxis = oSystem.XAxis Set oCurve = oSystem.Curves2D.Item(Context.SubObject.Name) set oYAxis = oSystem.YAxisList.Item(oCurve.YAxisReference) 'Convert cursor position to axis coordinates x = oXAxis.ConvertPageXPositionToXAxisValue(Context.Position.X) y = oYAxis.ConvertPageYPositionToYAxisValue(Context.Position.Y) 'Find nearest point on curve Set oPoint = oCurve.FindNearestValue(x,y) 'Build tooltip text ToolTipText = ToolTipText & VBCrLf & "Point (" & oPoint.Index & ")" & VBCrLf & "X = " & RTT(oPoint.X) & VBCrLf & "Y = " & Str(oPoint.Y) 'Add assignment value which categorizes the value as a string value based on value limits Set oChannel = Data.GetChannel(oCurve.Shape.YChannel.Reference) ToolTipText = ToolTipText & VBCrLf & "Assignment value: " & oChannel.Values(oPoint.Index) Else Set oSubObject = Context.SubObject ToolTipText = "Sheet: " & Context.Sheet.Name & VBCrLf & "Sub object" & VBCrLf & "Name: " & oSubObject.Name & VBCrLf & "Type: " & GetConstNameForREPORTSubObj(oSubObject, oSubObject.Type) End If End Sub
Properties
AxisSystem2D | Position | Sheet | SubObject
