Re: Paragraphlength


23 dec 2008 kl. 16.46 skrev Brendan Murphy:

Hi again,
I got a few questions.

1) Is the following the only/best way of getting the paragraph- length?
myLength = FTParagraph.gettext.Len


You want to call FTParagraph.getLength. The length of the
paragraph is cached once it has been calculated. When you call the
len method on a string, it calculates the length of the string
each and every time by walking through the string. I have had
discussions with RS about caching the string length and I think
that change would speed up a lot of  programs out there in
general. This optimization on their part seems like a no brainer
since strings are immutable objects.

Thanks, I'll use that.



2) It seems that FTStyleRun.getEndPosition erroneously reports zero when the it spans the whole paragraph and the style starts in the previous paragraph and ends in the following.

Example:
this is <b>paragraph 1 <-- this is correct
this is paragraph 2 <-- FTStyleRun(tempParagraph.getItem(j)).getEndPosition reports 0
this is </b>paragraph 3 <-- this is correct

Note, style runs don't cross paragraph boundaries.

I know, but the second paragraph should have a style run of its own, spanning from first to last character, it doesn't.



I'll put this on my list to investigate.

FTC Website: 
http://www.truenorthsoftware.com/FormattedTextControl/FormattedTextControl.html
Set List Options (digest and vacation modes): www.freelists.org/list/ftcdev
List Archive: www.freelists.org/archives/ftcdev
Unsubscribe: Send email to ftcdev-request@xxxxxxxxxxxxx with "unsubscribe" in 
the subject field.



Other related posts: