[BUG] #widthOfString: in addHorzScrollbar
dway at mailcan.com
Fri Mar 12 20:03:20 UTC 2004
Avi Bryant wrote:
> If a PluggableListMorph is given a styled item with the
> addHorzScrollbar changeset loaded, the Text object will eventually get
> given to AbstractFont>>widthOfString:, which doesn't know how to deal
> with it. I'm not sure who is at fault here (should #widthOfString: be
> able to deal with Text? Should it make sure to convert its argument
> to a string first? Should the PLM be converting its items to strings
> before asking about their widths? Should my code not be giving a Text
> item to a PLM?).
> Full debug log is attached.
For what it's worth, I ran into the same problem. If we could get this
resolved, it'd be great to get the addHorzScrollbar changeset
incorporated into 3.7. Other than this problem, it looked pretty good.
Offhand, it seems reasonable that AbstractFont should know how to
compute the width of some styled text. (Converting to a String ahead of
time wouldn't be ideal because bold text is often wider than non-bold
text, for example.) The only problem then is that the method should be
renamed to widthOfStringOrText:, or something like that.
More information about the Squeak-dev