Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!apple!agate!garnet.berkeley.edu!bmyers From: bmyers@garnet.berkeley.edu (Brian Myers) Newsgroups: comp.sys.mac.programmer Subject: Changing string length in Pascal Summary: I need to know how to do that in MacPascal Message-ID: <1990Aug28.063939.18174@agate.berkeley.edu> Date: 28 Aug 90 06:39:39 GMT Sender: usenet@agate.berkeley.edu (USENET Administrator;;;;ZU44) Organization: University of California, Berkeley Lines: 31 I'm doing some textedit stuff in a Pascal program. I've got it working in Lightspeed Pascal, and now I need to port it to MacPascal. When the user is through editing in the textedit control, TEGetText gives you a handle to whatever the user typed. I call my handle "hText." Next I need to copy whatever the user typed, which in this case will always be less than 255 characters, into a standard string variable. Here's how I do it in LightSpeed: hText := TEGetText(hTE); TextString[0] := chr(hTE^^.teLength); {**NOTE THIS LINE**} for count := 1 to hTE^^.teLength do TextString[count]:=hText^^[count-1]; That seems to work fine. Unfortunately, MacPascal won't let me touch the [0] element of any string. So if TextString started with a length of, say, 10, I can only copy ten characters from hText^^, and then I get an error message saying the index is out of range. Is there some other way to accomplish this transfer of text from a handled memory object to a string variable? Brian (reply direct; I will summarize here.) --------------------------------------------------------------------------- Brian Myers bmyers@garnet.berkeley.edu