Object: PolarAxisSystemClickedWithKeyContext

DIAdem 2018 Help


Edition Date: June 2018
Part Number: 370858P-01
View Product Info

DOWNLOAD (Windows Only)


DIAdem 2017 Help
DIAdem 2018 Help
DIAdem 2019 Help
DIAdem 2020 Help
DIAdem 2020 SP1 Help

The PolarAxisSystemClickedWithKeyContext provides the polar axis system in DIAdem REPORT when you call the event you assigned to the OnAxisSystemPolar for ClickedWithKeyEvents property. DIAdem calls this event when you click a polar axis system while pressing a key. For this event DIAdem does not support keys such as <Alt>, <Ctrl>, and <Shift>. Use the methods ConvertPageXPositionToXAxisValue, and ConvertPageYPositionToYAxisValue to convert the page coordinates of a polar axis system.

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 an polar axis system and assigns the user command MyClickEvent to the OnAxisSystemPolar for ClickedWithKeyEvents property:

Dim oMyPolarSystem, oMyPos, oMyPolarCurve
Call Report.NewLayout()
Call Data.Root.Clear()
Call DataFileLoad(DataReadPath & "Report_Data.tdm","TDM","")

Set oMyPolarSystem = Report.ActiveSheet.Objects.Add(eReportObjectPolarSystem, "MyPolarSystem")
Set oMyPos = oMyPolarSystem.Position.ByCoordinate
oMyPos.X1 = 20
oMyPos.X2 = 80
oMyPos.Y1 = 20
oMyPos.Y2 = 80

Set oMyPolarCurve = oMyPolarSystem.CurvesPolar.Add(ePolarShapeLine, "MyPolarCurve")
oMyPolarCurve.Shape.XChannel.Reference = "[5]/[1]"
oMyPolarCurve.Shape.YChannel.Reference = "[5]/[4]"

'This event will be raised if you click a 2D axis system while you press a keyboard key
Report.Events.ClickedWithKey.OnAxisSystemPolar = "MyClickEvent"
Call Report.Refresh()

If you press the <C> key and click the axis system, the user command specifies the mouse position. The example calculates the radius and the angle from the mouse position and displays them in a message. The user command receives a parameter. The first parameter corresponds to a PolarAxisSystemClickedWithKeyContext object and provides information about the polar axis system in DIAdem REPORT.

Sub MyClickEvent(Context)
  Dim oSystem, oCurve, Lenght, Angle, oXAxis, oYAxis, oPoint, sgMessage, oChannel, oSubObject
  Context.DoProceed = False'True
  'Check the key
  If Chr(Context.KeyValue) = "C" or Chr(Context.KeyValue) = "c" Then
    Context.DoProceed = True
    Set oSystem = Context.AxisSystemPolar

    'Map cursor point to length and angle
    Lenght = oSystem.ConvertPageXYPositionToLength(Context.Position.X, Context.Position.Y)
    Angle  = oSystem.ConvertPageXYPositionToAngle(Context.Position.X, Context.Position.Y)

    'Build message text
    sgMessage =  "Lenght: " & VBTab & Lenght & VBCrLf & "Angle: " & VBTab & Angle
    Call MsgBoxDisp(sgMessage,,,,5,True)
  End If
End Sub

WAS THIS ARTICLE HELPFUL?

Not Helpful