Announcement

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

    Label width issue

    I am using SmartGWT 4.1 power edition.
    I have a label that is set to width 300, in a HLayout.
    There is a very long string with no white space in it. Such as,
    "a0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789".

    In the CSS, it is set to "word-wrap:break-word".

    When the label is set with the long string, it wraps around with width 300. That is correct.

    Then it is set to a different value by setContents(), such as "abc".

    Then it is reset to the long string by setContents(). But it becomes a one-line long string. The width is 1920, instead of 300. Even if I reset width to 300, it doesn't work.

    #2
    We can't tell what the actual problem is without a way to reproduce it. But as a guess, you probably put the CSS settings into canvas.contents, and this means the CSS setting would of course be lost by a call to setContents(), which replaces canvas.contents entirely.

    Comment


      #3
      The style is set by setStyleName on the Label. From firebug, I can see the style is still there, but the width is set to 1920px. So the word-wrap setting won't work.

      Comment


        #4
        What is the proper way to replace a Label text?

        Comment


          #5
          We can't tell what the actual problem is without a way to reproduce it.

          If you'd like us to look into this, please provide all the details listed in the FAQ.

          Comment


            #6
            .paramLabelNormal_top{
            font-size:13px;
            font-weight:normal;
            padding-top:2px;
            word-wrap:break-word;
            }
            mDescriptionValue.setValign(VerticalAlignment.TOP);
            mDescriptionValue.setStyleName(NimbleCssResources
            .paramLabelNormal_top());
            mDescriptionValue.setWidth(300);
            mDescriptionValue.setOverflow(Overflow.CLIP_H);

            hLAyout.setMembers(mDescriptionViewLabel, mDescription,
            mDescriptionEditValidationWrapper, mDescriptionValue);

            mDescriptionValue.setContents(getmDescription());

            Comment


              #7
              This is not runnable code. Again please review the FAQ for the basic information you need to post every time:

              1. full SmartGWT version (not just 4.1)

              2. browser(s) and versions where issue appears, including OS and version

              3. GWT version

              4. runnable code to reproduce the problem

              There's no general issue with setContents() wiping out CSS settings.

              Comment


                #8
                yup, setWrap(true) does not do what is expected on a long string.

                Comment


                  #9
                  @thomlep: if you'd like to report an issue, please see the FAQ on how to do so, and start a new thread.

                  Comment

                  Working...
                  X