Create a Custom View

Return to Introduction  Previous page  Next page

A custom view must be designed as an ActiveX custom control and inserted through the automation interface.

ActiveX custom controls can be created using most well-known programming tools including Microsoft Visual Studio.NET.  See the documentation provided by the relevant vendor on how to create a custom control to produce an OCX file.

Once the custom control has been created and registered on the target system, it can be added through the AddTab() method of the Repository object.

While it is possible to call AddTab() from any automation client, it is likely that you would call it from an Add-In, and that Add-In is defined in the same OCX that provides the custom view.

C# example code is shown here:

       public class Addin

       {

               UserControl1 m_MyControl;

 

               public void EA_Connect(EA.Repository Rep)

               {

               }

 

               public object EA_GetMenuItems(EA.Repository Repository, string Location, string MenuName)

               {

                       if( MenuName == "" )

                               return "-&C# Control Demo";

                       else

                       {

                               String[] ret = {"&Create", "&Show Button"};

                               return ret;

                       }

               }

 

               public void EA_MenuClick(EA.Repository Rep, string Location, string MenuName, string ItemName)

               {

                       if( ItemName == "&Create" )

                               m_MyControl = (UserControl1) Rep.AddTab("C# Demo","ContDemo.UserControl1");

                       else

                               m_MyControl.ShowButton();

               }

               

       }