LotusScript equivalent for @Command TextSetFontColor?

In an form I have an action button:

changetext

Unfortunately this TextSetFontColor command only allows these colors:

  1. Black
  2. Gray
  3. Red
  4. DarkRed
  5. Green
  6. DarkGreen
  7. Blue
  8. DarkBlue
  9. Magenta
  10. DarkMagenta
  11. Yellow
  12. Brown
  13. Cyan
  14. DarkCyan
  15. White

In the Help file it says:

Language cross-reference
NotesColor property of LotusScript NotesRichTextStyle class

Is there anyone who has written the LotuScript equivalent to change the color of selected text in a rich text field (with RGB value)?

Advertisements

3 thoughts on “LotusScript equivalent for @Command TextSetFontColor?

  1. Ben Langhinrichs 2013-April-24 / 11:43 pm

    The NotesColor property requires knowing what the Notes palette is set to and using the ordinal number. The first 16 colors are fixed and easy to identify. After that, it depends on how your palette is set.

    Of course, with the Midas Rich Text LSX you would just say:

    rtchunk.Font = “Arial 14pt #c1ac34”

    or

    rtchunk.Font = “Times New Roman Pink 7pt”

    or

    rtchunk.Font = “rgb(255,16,32) bold underline 14px”

    or whatever. But that would be with Midas.

    • Patrick Kwinten 2013-April-25 / 10:53 am

      but would that run on the selected text e.g. from an action button?

      • Ben Langhinrichs 2013-April-25 / 12:42 pm

        Sure it would. It takes a slight trick, but is fairly easy. If you want to give it a try, I can send you a sample. Essentially, you are marking the selection by doing a NotesUIDocument.Copy, NotesUIDocument.InsertText and NotesUIDoc.Paste, then using the backend Midas call to find the marked text and change the color. It is harder to explain than to do. All of this can be done without ever going out of edit mode.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s