realbasic-nug
[Top] [All Lists]

Re: Truncating Text at various sizes

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Truncating Text at various sizes
From: "Joseph J. Strout" <joe at realsoftware dot com>
Date: Mon, 18 Feb 2002 15:25:38 -0800
At 4:40 PM -0600 2/18/02, Scott Crick (Lists) wrote:

  truncWhere = TruncString(width, m, truncWhere)

The problem with this is, it appears to assume that the text is formatted as
Geneva, 10 pt. I need this to be able to work at any given font and size.
Anyone have any ideas?

It assumes the the text is formatted as whatever the current font and size are. The trouble is that in RB, you don't have control over the "current" font and size -- that's something you're shielded from. However, you can probably force the issue in an unthreaded app by drawing a string to some graphics object in the desired font and size, and then immediately calling TruncString.

HTH,
- Joe

--
,------------------------------------------------------------------.
|    Joseph J. Strout           REAL Software, Inc.                |
|    joe at realsoftware dot com       http://www.realsoftware.com        |
`------------------------------------------------------------------'


<Prev in Thread] Current Thread [Next in Thread>