12-02-2019 03:34 PM
In DIAdem 2019 (View Panel) when I switch to a curve cursor the y cursor does not automatically appear in the legend anymore. This has to be added manually for each area. I am trying to write a script that will do this, but am having issues with displayobj as it says it is no longer supported. However all the examples in the help file still use displayobj. Is there a setting to turn this functionality back on in DIAdem 2019 or is there a different way to access the legend options in a script? The code I was trying to use is below.
Solved! Go to Solution.
12-05-2019 04:52 PM - edited 12-05-2019 04:53 PM
Hi JSal85,
The DisplayObj is still available in DIAdem 2019. I suspect you had a non-CurveChart2D area in your active sheet that your script was tripping over. Try this:
FOR Each Area In VIEW.ActiveSheet.Areas
IF Area.DisplayObjType = "CurveChart2D" THEN
Set LegendItems = Area.Displayobj.LegendItems
Found = FALSE
FOR Each Item In LegendItems
IF Item.Name = "CursorY" THEN Found = TRUE : Exit For ' Item
NEXT ' Item
IF NOT (Found) THEN Call Area.Displayobj.LegendItems.Add("CursorY")
END IF ' Chart2D Area
NEXT ' Area
Brad Turpin
Senior Technical Support Engineer
National Instruments
12-10-2019 08:42 AM
@Brad_Turpin thanks for the reply. My areas were all CurveChart2D. However your suggested code worked fine. Thank you!