Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Mithal on November 17, 2010, 09:49:10 pm
-
Hi I have created a active X control using VB 6.
i have registered it and now trying to use it in my EA Addin.
i am using the follwing code:
Repository.AddWindow("Test Window", "Project1.UserControl1");
the code executes with no exception raised but the window does not get added, i even checked under the work space layout.
Does the control have to be written in .NET?
If i try to add it using:
Repository.AddTab("Test", "Project1.UserControl1");
i get the "attempted to read or arite protected memory error...."
Please can someone help with this or maybe point me to the correct Microsoft articles that shows how to create a OCX in .NET
Thanks in advance. :)
-
Mithal,
I think there is another topic about the addWindow somewhere.
That might be of help.
Geert
-
Thanks for the reply.
I have made progress with writing the .NET usercontrol and it works fine if i use it with the AddTab method available from the repository
i followed the article from this link
http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/creatingacustomview.htm
The problem i have i can add the user control using the addwindow method which works, the code is like this
m_MyControl = (Test.UserControl1)Repository.AddWindow("SYSPRO Window", "Test.UserControl1");
m_MyControl.BringToFront();
IntPtr myPtr = m_MyControl.Handle;
Now i cannot find my window, i did look under the Workspace Layouts and there is nothing. How can i trouble shoot this
I am on version 8.0 of Enterprise Architecture. Build 856.
Please Help.
Thanks in Advence.
-
Thanks for the reply.
I have made progress with writing the .NET usercontrol and it works fine if i use it with the AddTab method available from the repository
i followed the article from this link
http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/creat...
The problem i have i can add the user control using the addwindow method which works, the code is like this
m_MyControl = (Test.UserControl1)Repository.AddWindow("SYSPRO Window", "Test.UserControl1");
m_MyControl.BringToFront();
IntPtr myPtr = m_MyControl.Handle;
Now i cannot find my window, i did look under the Workspace Layouts and there is nothing. How can i trouble shoot this
I am on version 8.0 of Enterprise Architecture. Build 856.
Please Help.
Thanks in Advence.
-
Mithal,
It should have been added to the View|Add-in Windows
Geert
-
Ah Thank you.
-
Hi Geert, hi Mithal.
I have the same problem Mithal encountered with the addTab, i get an AccessViolationException telling me that i try to access some protected memory.
Repository.AddTab("OEA Export", "Export.TestPan");
TestPan is a UserControl, and Export is the namespace of the class.
Is it the right syntax? How could i go through this problem?
Thank you very much by advance,
SJ.
-
Hi all,
I am having a problem about adding a add-in window to Enterprise Architect.
First of all, I am using Visual Studio 2010 and C# as the language.
I just followed the code in the following link:
http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/creatingacustomview.htm
but the only problem is, I don't understand how I am going to use UserControl1.
So, " UserControl1 m_MyControl;" I could not created an instance of Usercontrol to hold the pointer of the addWindow, to manipulate it.
Actually, I tried to create an ActiveX custom control object, but it seems so complicated that I tried many many times but none of them ended up with something works.
At this point I really appreciate any help that might give me a clue to where to start. I only need to create the object to hold the pointer of addWindow() and manipulate it as I need.
I even created some simple class, and registered it's .dll file with regasm.exe to the registry, but I am still not able to create an instance of the class that I registered, in my code.
I dont know if I need to add some "using" clause?
I appreciate your help.
Thanks,
Murat.
-
I've added a working example of this to my example add-in at
https://github.com/GeertBellekens/Enterprise-Architect-Add-in-Framework
Geert
-
I've added a working example of this to my example add-in at
https://github.com/GeertBellekens/Enterprise-Architect-Add-in-Framework
Geert
Thanks a lot, I appreciate.
-
Nothing about addTab? If you prefer, i can create a thread on that topic. That's quite annoying, i really don't understand why it works on my boss computer (EA 7.5) and on my dev and test environment (EA 8), it crashes :(
On my dev env, i'm using Visual Studio, so if i'm not wrong there is no COM register issue liely to happen, right?
-
Sébastien,
I think AddTab works the same way as AddWindow.
It's not because you are using Visual Studio that you can't have COM registration issues, but a crash usually has other reasons.
I had an issue recently with EA crashing (hard) when I was trying to use the Repository object before the model was fully loaded.
You have to be especially careful with the EA_OnContextItemChanged event and the likes, since they can be launched by EA before the Repository object is ready to be used.
I found that the EA_FileOpen event is a good one to indicate a fully loaded and ready Repository object, so I used that to flip a switch on my add-in class like this
public void EA_FileOpen(EA.Repository Repository)
{
this.EAFullyLoaded = true;
}
Then in the EA_OnContextItemChanged I do following:
public void EA_OnContextItemChanged(EA.Repository Repository, string GUID, EA.ObjectType ot)
{
if (this.EAFullyLoaded)
{
// do useful stuff
Geert
-
I'll try that but i'm not using the OnContextItemChanged event. The only thing we're doing is
public String EA_Connect(EA.Repository Repository)
{
m_RepositoryView = Repository.AddTab("OEA Browser", "OEA.TestPan") as UserControl;
return "OEASparxConnector.AddIn started";
}
OEA being my namespace, and TestPan a classic UserControl (that does nothing except displaying a empty text field and a button). What is odd is that this kind of code works on another computer, that's quite confusing :-/
-
Thank you very much Geert, that made the trick!
I moved my call to addTab only when EA detects a project is loaded and it seems to work great now!
Have a very nice day and thank you again for your help,
SJ.
-
Hello Guys,
Objective:
Use AddWindow to Call a User Control within the ActiveX Control window where the Addin is installed as an application
I have an issue where the AddWindow works properly from Visual Studio(Dev Mode) and not when its installed as an application.
I Use a "User Control" into the ActiveX Control which is not working as expected. Then I Also tried loading the user control inside a Windows Form it is working properly.(from an installed application).
What am i missing here Some Info. will be really helpful.
P.S:
Here i Use Wix to build the application setup.
I disabled all the other addins and it is still not working.
Thanks in advance.
-
This is probably because your windows form isn't registered properly for COM interop. In that case Windows will not be able to resolve the name used in AddWindow().
Geert