Re: Sizing a FTC based on content size

Ron Benditt wrote:
> I know we discussed this subject briefly many months ago... but now
> I'm hot into getting it to work this time!  I'm trying to put RTF into
> an FTEditField, and then set the height of the FTEditField to match
> the size of the contents.  So I'm doing this:
>
>       eField.setRTF(s)
>
>       TextHeight=eField.getDoc.getPageHeightLength
>
>       If TextHeight<38 Then
>         TextHeight=38
>       End If
>
>       eField.Height=TextHeight
>       eField.resize
>
> What I'm finding is that I often get an unreliable TextHeight back
> from the getPageHeightLength function.  I found that the FTEditField
> appears to recalculate itself many times and eventually it arrives at
> the correct number.  So if I were to set the RTF and then do the
> adjusting in a timer that fires 2 seconds later, it works correctly
> every time.  But if I try to adjust things as I show above, it is
> usually wrong.  Is there some sort of update that I can call between
> setting the RTF and calling the getPageHeightLength method?

This is probably a matter of making sure it is composed before
getting the height. Send me a project with a quick and dirty set
up that shows problem and I will see what I can do to make it more
reliable for you.

FTC Website: http://www.truenorthsoftware.com/formattedtextcontrol
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: