Changing <gtext>.value doesn't update <gtext>.width

Add a gtext element:

bodyText = bodyBackground.addTextObject("This is some text", "Arial", 20, "Black", 0, 0);

Then change the text to something shorter:

bodyText.value = "Text";

And you end up with "Text" streched to fit the original width of "This is some text"! Surely, it should recalculate <gtext>.width to the width of the new value?

[353 byte] By [JonathanAbbott] at [2008-2-16]
# 1
what a funny bug i found a work around try this

bodyText = bodyBackground.addTextObject("This is some text", "Arial", 20, "Black", 0, 0);
bodyText.value = "Text";
bodyText.width = 0;

Tomfromcener.co.uk at 2007-9-3 > top of Msdn Tech,Gadgets,Sidebar Gadget Development...
# 2
Well spotted!

If you want the Gadget (Polaroid) that sparked off all the issues I've recently reported, head here. In the end I opted to remove all the g:background objects and recreate them.

What was supposed to be a one hour gadget, turned into two days of trying to work around all the bugs I found in Sidebar. I think I found six in the end!

JonathanAbbott at 2007-9-3 > top of Msdn Tech,Gadgets,Sidebar Gadget Development...
# 3
I try to keep track of bugs reported on this forum, but just to be sure, I'd appreciate it if you could send me the list of issues you found - Bruce.Williams@microsoft.com.
BruceWilliams at 2007-9-3 > top of Msdn Tech,Gadgets,Sidebar Gadget Development...
# 4
Will, do. I'll create you a load of Repro's as well.

EDIT: If anyone else is interested in looking at the screenshots or the Repro gadgets, go here. I'll maintain this list, so we can track known bugs and workarounds.

JonathanAbbott at 2007-9-3 > top of Msdn Tech,Gadgets,Sidebar Gadget Development...
# 5
Thanks!
BruceWilliams at 2007-9-3 > top of Msdn Tech,Gadgets,Sidebar Gadget Development...