Instruments-Panel: Getting Ordinal of Enum from Value-Edit in VbsMacro

Professional Windows® software to communicate with CAN and CAN FD busses and its add-ins: Plotter, CANdb Import, Instruments Panel, and J1939
Post Reply
scope
Posts: 18
Joined: Wed 24. Jan 2024, 15:42

Instruments-Panel: Getting Ordinal of Enum from Value-Edit in VbsMacro

Post by scope » Thu 23. May 2024, 17:51

Hello Marvin!
Hope you are doing well!

Is ther a way i can get the Index of a selected value in a Value Edit that is connected to a signal with an ENUM?

Code: Select all

Dim panel, temp
Set panel = Documents("HMI-Internal_CAN.ipf").ActiveWindow.Object
Set temp = panel.Scenes(1).Controls("ve1")
'''''''''' here i want to read the index of the selected choice of the Value Edit
Thanks

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Instruments-Panel: Getting Ordinal of Enum from Value-Edit in VbsMacro

Post by M.Heidemann » Fri 24. May 2024, 10:36

Hey Scope,

Please create a new topic if your questions is unrelated to the original topic,
this is alot easier to search for other users.

I created a new topic from your response.

I extended your code to show how you can get the ordinal of the enum contained
in the signal assigned to your Value-Edit:

Code: Select all

Sub GetValueEditEnumOrdinal()

Dim panel, temp, assignedenum, index, tempval
Set panel = Documents("HMI-Internal_CAN.ipf").ActiveWindow.Object
Set temp = panel.Scenes(1).Controls("ve1")
set assignedenum = temp.Signal.Enum
tempval = temp.Value
index = assignedenum.FindOrdinal(tempval)

PrintToOutputWindow index

End Sub
As you can see, i use the current value of the Value-Edit to get the Ordinal via ENUM.FindOrdinal
---
Marvin Heidemann
PEAK-Support Team

Post Reply