In article
<ad89a2b9c20fdb1ead08c995194e075e@localhost.talkaboutmac.com>,
> Hi,
>
[quoted text clipped - 19 lines]
> Thanks and Regards
> Sanjaya
In my own code, I use a keyDown handler that, after it has checked for
Clear, Left, Right, Up, Down, Home, End, PageUp, PageDown, and backSpace
does:
if(TEMAX -1 <= (**text).teLength){
TellAnyError(MUSTTRUNCATE);
}else{
TEKey(chr, text);
}
With a similar protection on Paste.
There is similar code in LTextEditView.cp
1.) a TE can't handle even 32767 characters. Pick a smaller maximum.
2.) You don't need to lock a teHandle to assign to if from simple
variables.
3.) Rarely do HLock() xxx HUnlock(). What if it were already locked on
entry?
You should use HGetState(); HLock(); xxx HSetState();
4.) Don't assign to selEnd. Use TESetSelection()
5.) You also have to resize the actual hText text handle with
SetHandleSize()