Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: Graham_Moir on February 22, 2006, 05:57:00 am
-
Have I missed something ?
If I add a shape script to a stereotype, it certainly displays on diagrams, but I then can't see the element name. Even if I make the shape smaller than the available element selection area, no text appears.
What am I doing wrong ?
thanks
-
I guess nothing. There is no function to place the element name (an/or other properties) in the shape.
-
Looks that way Thomas, although I thought the name might appear if you don't use the whole area allocated to the element for the shape. Also you if you use an image, the element name still appears underneath it. A bit inconsistent I think !
-
This feature is quite new and probably they still work on improvements/corrections. It's also not unlikely that there are some yet undocumented treasures. However, we should report these flaws and ask for improvements.
-
Hello all,
I think you must specify where to show the element name when you set some script to stereotype.
This is a sample from BPMN add-in:
(DataObject stereotype)
shape label
{
setOrigin("SW",0,0);
print("#NAME#");
}
I think it's acceptable because EA doesn't know if script creator wants to show the name or not.
--
t-kouno
-
Takeshi's answer above shows how to create a floating text box. Alternatively, to have the text inside the shape, try something like the following:
shape main
{
layouttype="border";
// all drawing instructions here...
addsubshape("name","center");
text name
{
h_align="center"';
PrintWrapped("#NAME#");
}
}
Using the border layout allows you to add subshapes to the edges of a shape or in the centre. The alternatives are "leftright" or "topbottom". Have a look at the activity shapescript in the BPMN add-in for an example of multiple-nested subshapes where a subshape is created left to right and then added to the bottom edge of a border layout.
Sorry we're still working on the shape script help, but we're happy to offer any help in the mean time.
Neil
-
This is very interesting. I didn't realise shape script had these additional commands.
I wanted to extend the different GUI elements that are available for designing user interfaces. I noticed that there was not a GUI table element availble so posted previously if I could create one with shape script. It soon became apparent that I could not because of the limitations of the scripting language. However, it is perhaps now possible.
Can you take a look at my previous posting and let me know if it is possible using shape scripts undocumented commands to achieve a table like GUI element?
http://www.sparxsystems.com.au/cgi-bin/yabb/YaBB.pl?board=general;action=display;num=1139938200
-
It would be nice to have something that fixes the aspect ratio of a shape. Similarly to sizing an <<entity>> shape that always keeps the circle.
Another problem: I was not able to place the name text below the shape (I want something like the entity shape).
-
Here are some more #-Statements I dragged out of the EXE
#AUTHOR#
#CONTENTS#
#CONTENT#
#TYPE#
#SCOPE#
#CONST#
#ABSTRACT#
#STATIC#
#PARAMS#
#ALIAS#
#CONCURRENCY#
#STEREOTYPE#
#ISQUERY#
#CONSTRAINTS#
#TAGLABEL#
#NOTE#
#CONNTYPE#
etc.
I noticed for some of them that they produce meaningful results. I did not check all of them and probably they are context sensitive.
The forthcoming documentation will explain them for sure ;)
-
I was not able to place the name text below the shape (I want something like the entity shape).
Try something like:
shape main
{
layoutType="Border";
AddSubShape("Icon","Center");
AddSubShape("Name","S"); // S for South
shape Icon
{
startpath();
ellipse(0,0,100,100);
endpath();
fillandstrokepath();
moveto(0,100);
lineto(100,100);
}
shape Name
{
PreferredHeight=20;
H_Align="Center";
Print("#NAME#");
}
}
-
Try something like:
...
Thanks Neil! Never could have guessed the "S" option. I also tried a second parameter after "Center", which did 'something' ;). I will wait for the documentation.
-
[Thanks Thomas, I was not sure whether I could do this. I also had not noticed the "Remove" button, so was unaware that I could delete a specific post. Some people might think I was unobservant; those people would be correct...]
Hi folks,
Here is an excerpt from Neil's response to my earlier query on a similar subject. It may extend the usefulness of Thomas' list:
It looks as if most of the properties of an
element can be queried with the HasProperty() function and then
displayed with the text substitution macros. Here is the list of
properties that can be queried for diagram objects:
name, scope, type, classifier, propertytype, stereoType, alias,
language, complexity, version, phase, language, packageName, author,
status, dateCreated, dateModified, keywords, isTagged, isAbstract,
multiplicity, isroot, isleaf, isSpec, isActive, persistence, notes,
cardinality, visibility, concurrency, isEmbedded, parentEdge
So you can do something like:
if (HasProperty("language","Java"))
{
PrintWrapped("#dateCreated#");
}
My experiments to date suggest (but I'm not sure as yet) that the strings inside the # marks are case sensitive. My best guess is that you should try all upper case (as Thomas has listed) first.
HTH, David