AnsweredAssumed Answered

Editing multiple displays and their attributes using C#

Question asked by james_langham on Nov 19, 2012
Latest reply on Apr 2, 2015 by Eugene Lee
Branched to a new discussion

Hi All,

 

I've been trying to create a process book add-in that allows the user to edit every display with the same settings. The below code works if the displays are not in a Processbook, rather are just stand alone displays:

 

 

 
foreach (PBObjLib.Display dis in this.app.Displays)
{
//Edit displays here
}

 But, if the displays are in Processbook entries then I can't edit them in the same way. The below code I've tried to implement doesn't work, it takes all the open Processbook's, then takes their entries and checks if they are displays or not. I then try and cast the entry into a display type, this is the part I haven't gotten correct yet:

 

 

 
            foreach (PBObjLib.ProcBook procBook in this.app.ProcBooks)
            {
                foreach (PBObjLib.Entry dis in procBook.Entries)
                {
                    if(dis.Type == 1 || dis.Type == 2)
                    {
                        PBObjLib.Display display = (PBObjLib.Display)dis;
                        //Edit displays here
                    }
                }
            }

Also, is there a way of detecting when a display is opened so all previous changes will be applied to it as well?

 

 

 

Regards

 

 

 

James Langham

 

 

 

 

 

 

 

 

Outcomes