Book a Demo

Author Topic: create custom GUI component by profile  (Read 3153 times)

[email protected]

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
create custom GUI component by profile
« on: December 11, 2020, 09:58:49 am »
Good day,

I have a question about communication between add-in and shape script.
I know that if I want to call the method defined in my add-in script, I have to call the method from the shape script as follows: "#ADDIN: EAAddinArchimate, GetValueForShape, Stereotype, Alias #". At the same time, I have read in the documentation that the shape script does not allow iterating over objects in a collection.

My question - how to implement the following situation: I want to have the definition of values "tab1; tab2; tab3; .... tabX" in the tag value "tabs". I know how to read this value by add-in script and send value as a list to the shape script (but it is a string). How can I iterate it (from tab1 to tabX) and create objects for example GuiElement1 - GuiElementX below each other with name "tab1 - tabX"

If it is not posible by shape script, it is posible to do it in add-in ? very similar component is "Wireframing::WireframeTabControl"

my example from shape script
Code: [Select]
shape main

{
layoutType="leftright";

rectangle(0, 0, 100, 100);

print("#ADDIN:EAAddinArchimate, GetValueForShape#");

     addsubshape("red", 20, 10);
     addsubshape("blue", 20, 10);
     addsubshape("green", 20, 10);
     addsubshape("red", 20, 10);
     addsubshape("white", 20, 10);

shape white

     {

               setfillcolor(255, 255, 255);

               rectangle(0, 0, 100, 100);

     }

shape red

     {

               setfillcolor(200, 50, 100);

               rectangle(0, 0, 100, 100);

     }

     shape blue

     {

               setfillcolor(100, 50, 200);

               rectangle(0, 0, 100, 100);

     }

     shape green

     {

               setfillcolor(50, 200, 100);

               rectangle(0, 0, 100, 100);

     }

}

my example of method from add-in

Code: [Select]
        public string WidthGreenLine(EA.Repository repository, string eaGuid, object theParams)
        {

            return "tab1;tab2;tab3";

        }

Thank you very much.
« Last Edit: December 11, 2020, 10:22:05 am by [email protected] »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: create custom GUI component by profile
« Reply #1 on: December 11, 2020, 11:57:41 am »
You're lost. A shape script can do pretty nothing except a one pass drawing/printing with limited conditionals. There is no control structure (except the limited if which also does not know any boolean arithmetics, just true and false from functions returning that). You should think completely different (though I can't give you any hint as I don't know the context). In any case you should recall that add-in calls in shape scripts are very costly. If you have too many objects on your diagram using the add-in you will have a lot of time for coffee during opening your diagrams.

q.

[email protected]

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: create custom GUI component by profile
« Reply #2 on: December 11, 2020, 08:26:34 pm »
this is all true of what you have written and I am very well aware of it. But I would be very interested in how the "Wireframing :: WireframeTabControl" component is programmed, because I would like to do it on a very similar basis. How they programmed the repetition of tabs based on the values defined in the tag values "tabs"

for example, I want to make a component of a "tree" structure, where I will be able to define items of the tree in a tag value by next way,
This is XML from my tag value "tree"
Code: [Select]
<tree>
<items>Root1
<item>AAA</item>
<item>BBB</item>
<item>CCC</item>
</items>
<items>Root2</items>
<items>Root3</items>
</tree>

result I want to have in diagram im ma UIControl

Code: [Select]
- Root 1
-- AAA
-- BBB
-- CCC
+ Root 2
+ Root 3
« Last Edit: December 11, 2020, 08:41:00 pm by [email protected] »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: create custom GUI component by profile
« Reply #3 on: December 11, 2020, 09:03:50 pm »
That's hidden in EA.exe. If you personally know one of EA's coders: contact him. Else you're out of luck :-/

q.