>I modified my program, but I still got a white rectangle.

Here's some code that should work on all OS versions.

Regards,
Steve Mann

# # #

void            UTTruncateString
(
        Char *  strP,   // ( in/out ) the string to truncate
        Int16   width,  // ( in ) the max # of pixels to allow
        FontID  font    // ( in ) the font to calculate the width in
)
{
        Int16   strLength       = StrLen ( strP );
        Int16   strWidth                = width;
        FontID  oldFont                 = FntSetFont ( font );
        Boolean         truncated;

// Get the max # chars that can be displayed

        FntCharsInWidth ( strP, &strWidth, &strLength, &truncated );
        FntSetFont ( oldFont );

// Truncate the title and add trailing ellipsis.

        if ( strLength < StrLen ( strP ))
        {
                strP [ strLength - 1 ] = 24;    // ellipsis
                strP [ strLength ] = '\0';      // truncate
        }
}
-- 
Creative Digital Publishing Inc.
1315 Palm Street, San Luis Obispo, CA 93401-3117
-------------------------------------------
805.784.9461              805.784.9462 (fax)
[EMAIL PROTECTED]       http://www.cdpubs.com

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to