[comp.sys.mac.programmer] Why doesn't TEUpdate do an update?

jtn@ADS.COM (John T. Nelson) (12/06/90)

I seem to be having a problem with TEUpdate.  When I call TEUpdate
with all of the required parameters, nothing happens.  According to
Macintosh Revealed (okay, not the authoritative source but that's what
I've got), a TEUpdate should automatically do a TECalText and then
update my text fields.  Well after doing this nothing happens.

Something else wierd.  I set the teLength field of my edit record to
the length of the text in the hText field, but both TECalText and
TEUpdate set thee teLength field back to the size of the data area
pointed to by the Handle which contains the text hText is pointing to!
Because of this all of my scrolling calculations are off because every
update resets the text length field!  Can't calculate how much to
scroll when this happens!

Actually there is ONE way to get TEUpdate to work.  I call TECaltext
explicitly before doing the update, but this has the same problem with
reseting the length field.  TECalText munges it as badly as TEUpdate.

Anyone with wizard experience and the TE package?  This one is really
difficult to handle. :-)  Get it?  "Handle."  Kyuk kyuk.



--
ORGANIZATION:  Advanced Decision Systems   GEOGRAPHIC: Arlington, VA
UUCP:          kzin!speaker@mimsy.umd.edu  INTERNET:   jtn@potomac.ads.com
SPOKEN:        John T. Nelson              PHONE:      (703) 243-1611
PROJECT:        Macintosh hacking -- "Love the Machine... Hate the Company"

oster@well.sf.ca.us (David Phillip Oster) (12/08/90)

In article <4LA^!}+@ads.com> jtn@ADS.COM (John T. Nelson) writes:
>Something else wierd.  I set the teLength field of my edit record to
>the length of the text in the hText field
NO! Don't ever do this. TE guarantees that (**te).teLength ==
GetHandleSize((**te).hText). You should NEVER explicitly change (**te).teLength
Also, TEUpdate always works just fine. I use it all the time, including
to print (by doing TEUpdates at TEs that have been redirected to point to
the printer's grafPort.)
-- 
-- David Phillip Oster - At least the government doesn't make death worse.
-- oster@well.sf.ca.us = {backbone}!well!oster

time@tbomb.ice.com (Tim Endres) (12/08/90)

In article <22039@well.sf.ca.us>, oster@well.sf.ca.us (David Phillip Oster) writes:
> >Something else wierd.  I set the teLength field of my edit record to
> >the length of the text in the hText field
> NO! Don't ever do this. TE guarantees that (**te).teLength ==
> GetHandleSize((**te).hText). You should NEVER explicitly change (**te).teLength
> 
This is simply not true. IM states very clearly that one may modify
the teLength and hText fields. The catch is that you *must* call
TECalText() before performing any further operations with the TEHandle.

There is a one sentence indication on IM Vol I page 378.
There is the reference to TECalText() on page 382.

Set the two fields in question, then call TECalText(), then InvalRect(),
then TEUpdate() and things should work.

tim.

-------------------------------------------------------------
Tim Endres                |  time@ice.com
ICE Engineering           |  uupsi!ice.com!time
8840 Main Street          |
Whitmore Lake MI. 48189   |  (313) 449 8288