You may be aware of the setfontcolor() command. The Help defines this as:
setfontcolor(int red, int green, int blue) or setfontcolor(Color newColor)Sets the font color of a text string.
You can specify the required color by defining RGB values or using a color value returned by any of the Color Queries such as:
GetUserFontColor() or GetUserFillColor()
You can use this command with any of the text print commands. In your use of the setfontcolor you may have noticed that unlike the setpencolor command (with which one can say "draw a blue line, then a red line etc"), the setfontcolor command applies to the entire subshape (and in behaviour typical of Sparxian coding, "the last man standing gets the guernsey").
Notwithstanding this unintuitive behaviour, that's not the reason for this post (although it may save some poor users from scratching their head when their shapescript doesn't behave as expected).
What I'm writing about is an even more anomalous behaviour.
We recently "solved" (actually only partially) a problem that we've had for nearly a decade. We have an extensive piece of automation that allows us to place one of many names for a given element on a diagram on a per-diagram basis using the Label shape. However, that only works in the non-rectangular form. In rectangular form, the name compartment value can't be suppressed. Last week, we realised that if we set the font colour to the user fill colour, the name field effectively "disappears". We can then deploy our automation in rectangular mode!
So far so good! We could use shape Label both in rectangular and non-rectangular mode. We have two setfontcolor commands one in shape Main (setfontcolor(getUserFillcolor())

to suppress the Name field. And one in shape Label (setfontcolor(getuserfontcolor())

The intent being that the user can control the colour of the font in the label (simulating the Set Label Color menu item).
So further so good! Font colour seems right, we can change the default font colour using [F4] and the colour changes!
BUT (there had to be a but) if we set the local font colour using the Paintbrush Widget, both the Label AND the Name fields take on the colour (Notwithstanding the instruction in shape Main to use the fill colour)! The only way to avoid this is to set the local colour to the default colour in which case the rendering returns to the expected.
Some really weird behaviour. Is there some rational explanation for this or is it (as it appears) a defect?
Reported,
Paolo