[futurebasic] Re: [FB] Using TextEdit functions, anyone?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 2000 : Group Archive : Group : All Groups

From: Heather Donahue <HeatherDonahue@...>
Date: Sun, 17 Dec 2000 18:07:57 -0800
At 11:38 PM +0100 on 12/17/00, Alain Pastor wrote:

>Heather Donahue wrote:
>
>Is there something I'm missing to get the destination rectangle to
>change.  The text it there.  If I set the scroll range manually, it does
>work, but only for my sample text.
>
>Hi Heather,
>
>Haveyou tried to call TECalText and TEUpdate after changing the
>destination rectangle?

I asked on 'comp.sys.mac.programmer.help' last night and got a few 
ideas.  Nobody put there finger on it exactly.

It turns out that TextEdit doesn't update anything except teLength 
(total length of inserted text) after doing a TEInsert or 
TEStyleInsert.

I found I could take teLength and use TEGetHeight to get the size I 
needed to add to my destRect.

This works fine now:

// insert the text
CALL HLock ( hText )
Call TEStyleInsert ( [hText], FN GetHandleSize ( hText ), hStyles, txtHandle )
CALL HUnlock ( hText )

// Determine height of the Text and set destRect
destRect.bottom = destRect.top + FN TEGetHeight( txtHandle..teLength, 
0, txtHandle)
// add whole viewRect to scroll text out of view
destRect.bottom += viewRect.bottom - viewRect.top

// calculate scroll range
scrollRange = ( destRect.bottom - destRect.top ) - ( viewRect.bottom 
- viewRect.top )


-- 
Heather