I came up with the following shape script to put one label in the upper right corner of a box and another label in the center. But, I find that there are times when I want to stretch this box vertically in order to put subcomponents over the top of it. If I do that, the subshapes get stretch proportionally, so the #name# label ends up a bit over vertically centered. That isn't really desirable since I am likely to want to put a subcomponent over the middle like that. I can adjust the size of the top subshape and move the #name# label farther up, but not only does it not move as far as I would like when the box is tall, but it then overlays the label in the upper right.
Is there any way to get one in the upper right and the other a bit below it, but centered so that when the box is vertically minimized the #name# label is more or less centered, but it floats fairly near the top when the box is vertically stretched?
shape main
{
setfillcolor(204,255,255);
setpen(0,0,0,2);
rectangle(0,0,100,100);
addsubshape("stereotype",100,20); // I have played with
addsubshape("namelabel", 100,80); // these values
shape stereotype
{
v_align = "top";
h_align = "right";
println("«oeProgram» ");
}
shape namelabel
{
v_align = "top";
h_align = "center";
println("#name#");
}
}