Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    how to change the font color of TextItem.

    as title, i can not find such method as setFontColor(...), who can tell me how to do that?
    thanks.

    #2
    You can use setTitleStyle(), there are other styling methods as well.

    Comment


      #3
      thanks do you mean that i need to define css style?

      Comment


        #4
        Yes, you need to define the CSS Style.

        Comment


          #5
          in fact, i what to change the color of the text in text box, not the title, i guess, setTextBoxStyle method maybe work, right?

          Comment


            #6
            You can inline the CSS style too.
            Code:
            String orangeString = "<span style=\"color:#FFA500\">My orange string.</span>";
            It's a hack, but it can be useful in the short term.

            Comment


              #7
              dczech is correct, and setTextBoxStyle yes.

              Comment


                #8
                UNFORTUNATELY ,dears, the in-line style does not work here, soo my code:
                Code:
                        name = new TextItem("name");
                        String value = "<span style=\"color:#FFA500\">My orange string.</span>";
                        name.setValue(value);
                in the text box, just display the whole string including html tag. any suggestion?

                Comment


                  #9
                  That would only work for the title. You need to set the box style.

                  Comment


                    #10
                    Any idea why

                    Code:
                    formItem.setTitle("<span style=\"color:green\">foobar</span>");
                    works but

                    Code:
                    formItem.setTitle("<span style=\"width:200px\">foobar</span>");
                    doesn't?

                    Any suggestions as how to set the width of a FormItem's title would be greatly appreciated.
                    Regards,
                    Luc

                    Comment


                      #11
                      Normally the title width is related to the column where it resides. You can turn title wrapping off if that's an issue.

                      Comment


                        #12
                        Hi davidj6.

                        Do you mean

                        Code:
                        formItem.setWrapTitle(false);
                        formItem.setTitle("<span style=\"width:200px\">foobar</span>");
                        ?

                        That didn't change anything for me.

                        Regards,
                        Luc

                        Comment


                          #13
                          Yes and no. If you want to change title width because a title is wrapping, you can turn wrapping off. Otherwise, make sure the column holding the title is the width you want. IF you still have trouble consider posting a full test case.

                          Comment

                          Working...
                          X