wrong label offsetWidth after calling setStyle

View: New views
3 Messages — Rating Filter:   Alert me  

wrong label offsetWidth after calling setStyle

by frederic_viollet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi folks,

I've found a problem on the label's setStyle function.
Can you try out the following code please?

var lText = new rialto.widget.Label('lText',15, 60,document.body,"La connexion au service a échoué. Veuillez vérifier l'URL saisie dans l'onglet 'Configuration'",'libelle1');
alert(lText.getOffsetWidth());
lText.setStyle({whiteSpace : "pre"});
alert(lText.getOffsetWidth());

As you can see, before setting style, the size is 503. After calling setStyle, the size is 658. The problem is that there is no carriage return in the label. Obviously, 658 is not the right value : inspecting the page with firebug shows that the div is way bigger than the text...
Why does the size change?

Thanks.

Fred



Re: wrong label offsetWidth after calling setStyle

by François Lion :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Fred,

It's fixed.
(but I'm not sure I understood the meaning of your sentence
"The problem is that there is no carriage return in the label").

Please, just update the file rialto.js and re-try with it.

François

--- In rialto-dev@..., "frederic_viollet" <frederic.viollet@...> wrote:

>
> Hi folks,
>
> I've found a problem on the label's setStyle function.
> Can you try out the following code please?
>
> var lText = new rialto.widget.Label('lText',15, 60,document.body,"La connexion au service a échoué. Veuillez vérifier l'URL saisie dans l'onglet 'Configuration'",'libelle1');
> alert(lText.getOffsetWidth());
> lText.setStyle({whiteSpace : "pre"});
> alert(lText.getOffsetWidth());
>
> As you can see, before setting style, the size is 503. After calling setStyle, the size is 658. The problem is that there is no carriage return in the label. Obviously, 658 is not the right value : inspecting the page with firebug shows that the div is way bigger than the text...
> Why does the size change?
>
> Thanks.
>
> Fred
>



Re: wrong label offsetWidth after calling setStyle

by frederic_viollet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi François,

thanks for the fix.

Fred

--- In rialto-dev@..., François Lion <lion@...> wrote:

>
> Hi Fred,
>
> It's fixed.
> (but I'm not sure I understood the meaning of your sentence
> "The problem is that there is no carriage return in the label").
>
> Please, just update the file rialto.js and re-try with it.
>
> François
>
> --- In rialto-dev@..., "frederic_viollet" <frederic.viollet@> wrote:
> >
> > Hi folks,
> >
> > I've found a problem on the label's setStyle function.
> > Can you try out the following code please?
> >
> > var lText = new rialto.widget.Label('lText',15, 60,document.body,"La connexion au service a échoué. Veuillez vérifier l'URL saisie dans l'onglet 'Configuration'",'libelle1');
> > alert(lText.getOffsetWidth());
> > lText.setStyle({whiteSpace : "pre"});
> > alert(lText.getOffsetWidth());
> >
> > As you can see, before setting style, the size is 503. After calling setStyle, the size is 658. The problem is that there is no carriage return in the label. Obviously, 658 is not the right value : inspecting the page with firebug shows that the div is way bigger than the text...
> > Why does the size change?
> >
> > Thanks.
> >
> > Fred
> >
>