DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

DIAdem 2019 displayobj Issues

Solved!
Go to solution

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.

 
dim Area, LegendItems

FOR Each Area In VIEW.ActiveSheet.Areas
    Set LegendItems = Area.Displayobj.LegendItems.Add("CursorY")
Next
 
     Error in <ViewAddCursorY.VBS> (Line: 12, Column: 5):
     Object required: 'Displayobj'
 
When I tried to make it smarter by only adding cursor Y to areas that don't already have, it I get the error below for displayobj.
 
     Error in <ViewAddCursorY.VBS> (Line: 11, Column: 6):
     Object doesn't support this property or method
0 Kudos
Message 1 of 3
(1,922 Views)
Solution
Accepted by topic author JSal85

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

0 Kudos
Message 2 of 3
(1,848 Views)

@Brad_Turpin thanks for the reply.  My areas were all CurveChart2D.  However your suggested code worked fine.  Thank you!

0 Kudos
Message 3 of 3
(1,827 Views)