[comp.sys.mac.programmer] EditText question

kpmiller@uokmax.ecn.uoknor.edu (Kent P Miller) (04/30/91)

I have some source code that looks like this:

TESetSelect(0, 300, TE_Edit_Text);
TEDelete(TE_Edit_Text);
TEUpdate(TE_Rect_Edit_Text, TE_Edit_Text);
TESetText(@st[1], length(st), TE_Edit_Text);

This usually works fine.  But, if I select a little part of the text before
this code gets executed,  The text gets screwed up when it gets pumped into
the area.  For instance, if I try to pump in the a string, and I select some
of the original text in the area first, the first 4 characters are invisible.
What am I doing wrong?

Kent Miller
-- 
-----------------------
Kent Miller
KENT@aardvark.ucs.uoknor.edu
Bitnet -> KENT@uokucsvx

mxmora@unix.SRI.COM (Matt Mora) (04/30/91)

In article <1991Apr30.010156.4752@uokmax.ecn.uoknor.edu> kpmiller@uokmax.ecn.uoknor.edu (Kent P Miller) writes:
>I have some source code that looks like this:
>
>TESetSelect(0, 300, TE_Edit_Text);
>TEDelete(TE_Edit_Text);
>TEUpdate(TE_Rect_Edit_Text, TE_Edit_Text);
>TESetText(@st[1], length(st), TE_Edit_Text);
>
>This usually works fine.  But, if I select a little part of the text before
>this code gets executed,  The text gets screwed up when it gets pumped into
>the area.  For instance, if I try to pump in the a string, and I select some
>of the original text in the area first, the first 4 characters are invisible.
>What am I doing wrong?

Let me see if I understand what you are trying to do:
>TESetSelect(0, 300, TE_Edit_Text);
select chars 0-300

>TEDelete(TE_Edit_Text);
delete selected chars



>TESetText(@st[1], length(st), TE_Edit_Text);
set the te to hold the data in st.

What you might want to try is:
TESetSelect(0, 300, TE_Edit_Text);
TEDelete(TE_Edit_Text);
TESetText(@st[1], length(st), TE_Edit_Text);
TECalText( TE_Edit_Text);
EraseRect(TE_Rect_Edit_Text);
TEUpdate(TE_Rect_Edit_Text, TE_Edit_Text);



That might solve your problem.




-- 
___________________________________________________________
Matthew Mora                |   my Mac  Matt_Mora@sri.com
SRI International           |  my unix  mxmora@unix.sri.com
___________________________________________________________