Author Topic: Displaying visual EA elements in Add-in window  (Read 3897 times)

mcinar

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Displaying visual EA elements in Add-in window
« on: July 08, 2011, 07:55:24 am »
Hi,

I need to duplicate one of the tabs inside of my add-in window. So, instead of writing guid, or any text there, I would like to show visual content belong to EA.

I think I need to write a function inside Controller class, which extends UserControl, The function should probably be like named as Display(){} and it should take repository as an argument, and/or some EA type of diagram or element to show, but even after that I dont have any idea how to visualize that kind of objects in a new add-in window, or a new add-in tab.

I need some ideas to give me some clues to how to start.

I would appreciate if you can help me,
Thanks,

Murat.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Displaying visual EA elements in Add-in window
« Reply #1 on: July 08, 2011, 04:33:29 pm »
Murat,

You can show an image of a diagram in a your own window, but I don't think you can re-use the actual EA graphical elements.

Geert

mcinar

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: Displaying visual EA elements in Add-in window
« Reply #2 on: July 12, 2011, 12:12:52 pm »
Quote
Murat,

You can show an image of a diagram in a your own window, but I don't think you can re-use the actual EA graphical elements.

Geert
First of all, thank you very much for all of your help.

A this point, I implemented the template you provided and I think I got the logic underneath somehow. As far as I understand, the key thing is, MyAddinClass only knows about EA stuff such as repository and etc.. and MyEAControl knows about windows drawing stuff, since it is being extended from UserControl.

It is considerably reasonable to pass a string between these two classes because both of them knows string, but in my case, when I tried to put the exact content of an existing tab, I think MyEAControl will not understand the type that I will send, is that right? and is the solution for this problem is, extending both UserControl and EA_AddinFramework ? (interopEA.dll)

and aslo I think in the designer class, I need to put something else to display a "chart" instead of string, I'll try to figure it out tomorrow when I got to work.

And if you have any clue, or help that you can give me, I would really appreciate.

Thank you again,

Murat.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: Displaying visual EA elements in Add-in window
« Reply #3 on: July 12, 2011, 01:30:01 pm »
If I wanted to show the image of a class (for example) in my own control I would:
Create a dummy diagram.
Set the properties how I want.
Add the object to the diagram.
Save the diagram to a bitmap.
Delete the diagram.

Along with caching the images as necessary.

mcinar

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: Displaying visual EA elements in Add-in window
« Reply #4 on: July 13, 2011, 05:49:22 am »
Quote
If I wanted to show the image of a class (for example) in my own control I would:
Create a dummy diagram.
Set the properties how I want.
Add the object to the diagram.
Save the diagram to a bitmap.
Delete the diagram.

Along with caching the images as necessary.

Other than this solution, is it possible to show actual items in add-in windows or add-in tabs?

I talked to my colleagues and they want it to be active rather than passive, so; user would be able to make changes to a view by just interacting with the add-in.

But since C# is not supporting multiple inheritance, I cannot extend EA Framework and UserControl at the same time, and as an artifact of this, my Drawer class does not know about EA architecture stuff (repository, diagrams, elements etc..) it only knows windows kind of elements because it is extending UserControl.

At this point, I am only focused to create a new tab( which I am able to do) and trying to fill it with existing elements from other tabs, or just see if I can put any kind of EA elements in it just like other tabs has, but I could not succeeded yet.

If anyone has any kind of a solution to this problem, I would really appreciate.

Thanks a lot to everyone.

mcinar

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: Displaying visual EA elements in Add-in window
« Reply #5 on: July 15, 2011, 05:59:32 am »
So, I think it is not possible to show any active EA element inside add-in window or add-in tab, is that right?

I am writing in C# and since multiple inheritance is not supported by C#, I cannot extend UserControl and EA.AddinFramework at the same time so that's why I can only pass universal types such as string, or image(png) to the controller class which draws whatever is passed to it to the add-in window/tab.

Now, I am created some diagram and element inside my code, so these objects are created automatically prior to a specific event, and I activate my diagram so it is appearing as a tab, and it is active, so I can drag and drop any item to it.

But, I would like some specific items to be there when the creation code ran. So, does anyone knows how to place an element inside of a diagram physically? ( I am guessing I need to provide some kind of position parameters where will be the element placed)

I would appreciate any help.

Thanks.
Murat.