Announcement

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

    How do I set the style on hint inside TextItem

    Using SmartGwt, I use setShowHintInField(true) and I want to change the hint style so that the hint appears in gray. I'm new the SmartGwt so I don't know how to do it. The documentation for setShowHintInField says "CSS style for the hint is textBoxStyle with the suffix "Hint" appended to it" but I don't understand what it means. Do I set an attribute or property called textBoxStyleHint to whatever the CSS class I defined?

    #2
    Hai

    You can use the attribute "setHintStyle()" for the formitem.
    And specify the css class in the style.
    In my application its working.
    For eg:-
    DynamicForm loginForm = new DynamicForm();
    userItem.setTitle("LOGIN");
    userItem.setWidth(100);
    userItem.setHeight(18);
    userItem.setHint("(case sensitive)");
    userItem.setHintStyle("hintTextStyle");
    loginForm.setFields(userItem);

    You have to mention the css class in your html or .css file.
    .hintTextStyle{
    font-weight: bold;
    color: red;
    }

    Comment


      #3
      Check the skin's stylesheet for the textBoxStyleHint property.

      Comment


        #4
        anukv,

        I can't use setHintStyle() because it doesn't work when the hint is inside the TextItem.

        davidj6,

        How does looking at the CSS help me set the style to my CSS class? What method do I call? Or do I just override the class name, textItemHint, inside my .css file?

        Comment


          #5
          You have to change the style in css, not from an api call. This is necessary because the style for the hint has the style the textbox itself as well. Very different from a hint outside of the textbox.

          I thought when you saw the css style you would realize how it had to be done.

          Comment


            #6
            Thanks davidj6, I understand now.

            Comment


              #7
              Here's my CSS for the TextItem:

              .myTextItem,
              .myTextItemFocused,
              .myTextItemDisabled,
              .myTextItemError,
              .myTextItemHint,
              .myTextItemDisabled {
              padding:2px;
              border:1px solid #6AA0BB;
              background:rgb(230,241,247) url(./images/controls/text_input.gif) repeat-x scroll;
              color:#333333;
              }

              .myTextItemHint {
              font-size: 1em;
              color: Gray;
              }

              .myTextItemFocused {
              background-color: Yellow;
              }

              When the TextItem has focus, the background color does not change to Yellow. Anyone see a problem with the CSS? Is there a know bug about this?

              Comment


                #8
                Same Issue

                I have the same issue.

                setHintStyle() does not set the hint style when setShowHintInField() is true.

                Using smartgwt 3.1.

                Comment


                  #9
                  See post #5 in this thread.

                  Comment

                  Working...
                  X