Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

setting maximum length of TERec structure ( mac)

1 view
Skip to first unread message

vcmac

unread,
Apr 27, 2007, 5:54:08 AM4/27/07
to
Hi,

How could we set the maximum lenght of a TERec structure.
We want to set the maximum lenght for extended-edit type in mac to suppose
32767,
How should we do it ?

we coded like as below. But still (*teHandle)->teLength is not modified.
where teHandle is of typr **TERec

if( len > 32767 )
{
len = 32767;
HLock ((Handle)teHandle) ;
(*teHandle)->teLength = len;
(*teHandle)->selEnd = (*teHandle)->teLength ;
HUnlock ((Handle)teHandle) ;
}

Please suggest any way to achieve this ?

Thanks and Regards
Sanjaya

David Phillip Oster

unread,
Apr 27, 2007, 10:41:27 AM4/27/07
to
In article
<ad89a2b9c20fdb1e...@localhost.talkaboutmac.com>,
"vcmac" <sanjay...@lionbridge.com> wrote:

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()

0 new messages