Skip to main content
Known Participant
July 8, 2017
Answered

Add Fill Color to Field

  • July 8, 2017
  • 2 replies
  • 954 views

Hi,

How can I make the fill color of the following field blue?  I tried "fillcolor: color.blue" but it did not work.

                                 

                                          {

                                                    type: "static_text",

                                                    item_id: "sta8",

                                                    name: "Filename Preview:",

                                                    font: "palette",

                                                    fillcolor: color.blue

                                                },

                                                {

                                                    type: "edit_text",

                                                    item_id: "Exmp",

                                                    width: 300,

                                                    height: 65,

                                                    char_width: 8,

                                                    multiline: "true",

                                                    readonly: "true",

                                                },

This topic has been closed for replies.
Correct answer Joel Geraci

1) setForeColorRed() takes a string as a parameter, not an object and will only work when it is added to the initialize function of the dialog . The string is the item id of the element you want to be red. Please see my example higher up in the thread. If you don't have an initialize function, you need to create one.

2) It would be helpful if you posted the code for the entire dialog. With dialogs, it too hard to diagnose problems from snippets.

2 replies

Participant
July 8, 2017

Den er Grei

Joel Geraci
Community Expert
Community Expert
July 8, 2017

You're lucky you wanted red. Red is the only color you can use other than black. In your initialize function add the following line. Adjust the item_id to meet your needs.

dialog.setForeColorRed("sta8");

suemo22Author
Known Participant
July 8, 2017

Hi,

I can't get it to work still.  The Item ID is "Exmp."

function DoSetDocNumberFn(dialog, oDlg)

    {

               var oRslt = dialog.store();

               var strExample = oRslt["LPfx"];

              

               dialog.setForeColorRed("Exmp");

               dialog.load({"Exmp":strExample});

               DoSetFileName(dialog,oDlg);

    }

It still shows up as black text.

Joel Geraci
Community Expert
Community Expert
July 8, 2017

You have the line right but as I stated in my answer, the code must be added to the initialize function of the dialog.

Like this...

         initialize: function (dialog)

         {

             dialog.setForeColorRed("Exmp");

         },

There might be other code in initialize as well. My example is just the simplest case.