Book a Demo

Author Topic: shape script command setFontColor()  (Read 5331 times)

chrisHauert

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
    • View Profile
shape script command setFontColor()
« on: January 02, 2007, 05:58:03 pm »
For the moment the font color cannot be set by a shape script even though there exists a command "getUserFontColor()";  
My request:
Add a command "setFontColor(int red,int green, int blue);"

Further suggestion (see after "==>"):
why the set commands do not correspond to the according get commands:

  • setfillcolor()<-> getUserFillColor()==> OK
  • setpencolor()/setpen() <-> getUserBorderColor()==> setBorderColor()
  • ?? <-> getUserFontColor() ==> setFontColor()
  • setpenwidth()<-> getUserPenSize() ==> setPenSize()
« Last Edit: January 02, 2007, 11:53:43 pm by chrisHauert »
Cheers, Christoph

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: shape script command setFontColor()
« Reply #1 on: January 03, 2007, 06:13:20 am »
AFAIK, the GetUserFontColor() and similar functions allow you to capture the current settings to a variable. Having done that you can then set the pen color - this affects both fonts and drawing. When you've drawn or written (or both) whatever you needed in the new color, you can set the color back to the original setting by using the value you saved earlier.

In future - I don't think it is possible yet - you might also be able to test the current color settings to make sure you don't accidentally write in an 'invisible' pen by setting font color to the same as the user's default background color, or whatever.
No, you can't have it!

chrisHauert

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
    • View Profile
Re: shape script command setFontColor()
« Reply #2 on: January 03, 2007, 07:38:47 am »
As documented in the help-file (EA.chm::/miscellaneous.htm) you cannot declare variables at the moment. So the unique use of the get.. functions relies in their use as parameters in set... commands.
I wonder wether one of the two commands setpen() and setpencolor() might resolve the problem?
Cheers, Christoph

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: shape script command setFontColor()
« Reply #3 on: January 03, 2007, 08:46:23 am »
Yes, I think that's it.

I was testing this a while ago and I think I got it working. Of course, I did not save the actual code because I 'knew' I would remember.  ;)

I think what happens is that setting the pen color during a shape script is a 'temporary' action, but the current user setting is 'permanent.' This means you can just set the pen color back to the user color when you are done with your custom work. Something along the lines of SetPenColor(GetUserFontColor). A bit strange, since you might also have to set up some other colors, but if I remember, it seemed to work.

Still, there's more to be done here. Hopefully Sparx will address a few of these things soon. They could handle this the way you originally suggested, or start supporting variables.
No, you can't have it!