I have to display a paragraph in the palm using windrawchars funtion.

The length of the paragraph goes over the palm screen.
I want to divide the paragraph to number of lines with a length of 32.
wat should i need to do, to split the paragraph to number of lines.

As Ken Corey noted, using a multi-line, non-editable field would be the easiest approach. If you must restrict each line to a maximum of 32 bytes, and you _know_ that 32 bytes of data will always fit (visually), then the following snippet might work (untested):


        UInt32 textLen = StrLen(strP);
        UInt32 offset = 0;
        Coord yPos = <starting y position>;
        Coord xPos = <some fixed left margin>;

        while (offset < textLen)
        {
                UInt32 maxOffset = min(offset + 32, textLen);
                UInt32 endOffset = TxtGetWordWrapOffset(strP, maxOffset);
                WinDrawChars(strP + offset, endOffset - offset, yPos, xPos);
                offset = endOffset;

                yPos += FntLineHeight();
        }

-- Ken
--
Ken Krugler
<http://www.krugler.org>
+1 530-265-2225

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

Reply via email to