0 Replies Latest reply on May 10, 2012 10:44 AM by Green Goby

    getPreferredBoundsWidth of a truncated Spark Label not returning right value

    Green Goby Level 1

      I am writing a custom layout that autmoatically sets the width of a component to the greater of a "remainder" of what is left for the container and the preferred width of the component, but it is failing when that component is a spark label that has been truncated (maxDisplayedLines).

       

      I know what the remainder is, and when the Label is not truncated, it all works fine.  However, once the Label is truncated, the getPreferredBoundsWidth method always returns the current size of the truncated label. 

       

      I need a way to really get the preferred width of the Label, ignoring truncation. 

       

      I see there is a measureText some folks have used, but the api docs say that shouldn't be used for the spark labels.  Also, I'd prefer to try and keep this at the ILayoutElement level, but if i have to cast to a Label, I can do that. 

       

      I have already tried to set a larger width, then asking it for its preferred width, but that didn't work. 

       

      I am going to try the measureText and also trying to unset the maxDisplayedLines, but I am hoping there is a cleaner way.

       

      Thanks in advance for any help.

       

      Irv