Announcement

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

    Change the font of the title

    Hi, I'm using SmartGWT 2.4 and have a seemingly simple question.
    I have one form with a dark background and would like the title of the fields on this form to be a different color than the font colors defined for the skin.

    Any example how to do this?
    I tried fieldItem.setTitleStyle. But this doesn't seem to work and it also doesn't set the style for the field with the focus

    I tried form.setStyleName() but this seems to override the "normal" css class what is not the class used by the fields on the form.
    The style classes used are
    .formTitle
    .formTitleFocused
    .formTitleDisabled
    .formCellError
    .formTitleError
    .formHint

    what am I missing here?

    #2
    FormItem.setTitleStyle() should achieve this.
    The specified style should be a valid css className.
    You can easily verify this by (for example) setting the title style to "cellOver".

    Comment


      #3
      Originally posted by Isomorphic
      FormItem.setTitleStyle() should achieve this.
      The specified style should be a valid css className.
      You can easily verify this by (for example) setting the title style to "cellOver".
      Thank you, but that only changes the color for the 'normal' title (eg it overrides style class .formTitle). When the field has focus the title is black again.

      I see this has been marked as a issue
      http://code.google.com/p/smartgwt/issues/detail?id=544
      And that the solution is to
      Code:
       FormItem.setShowFocused(false);
      Last edited by meindert; 10 Feb 2011, 00:30.

      Comment


        #4
        The javadocs are missing the details on how styles are modified according to the field state:

        This string is the base css class name applied to a FormItem (or some part of a form item). The style name will be modified as the 'state' of the form item changes. Specifically:

        - If FormItem.showFocused is true, when the form item receives focus, this style will be have the suffix "Focused" appended to it.
        - If FormItem.showErrorStyle is true, if the form item has errors, this style will be have the suffix "Error" appended to it.
        - If FormItem.showDisabled is true, when the form item is disabled, this style will be have the suffix "Disabled" appended to it.

        So for example if the cellStyle for some form item is set to "formCell" and FormItem.showFocused is true, when the form item receives focus, the form item's cell will have the "formCellDisabled" style applied to it.

        Comment


          #5
          Ah! is that how it works. Thank you for the help

          Comment

          Working...
          X