Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!spool.mu.edu!uunet!world!aep From: aep@world.std.com (Andrew E Page) Newsgroups: comp.sys.mac.programmer Subject: Re: SetIText -- Does it make a copy? Message-ID: <1991Jun24.122927.4187@world.std.com> Date: 24 Jun 91 12:29:27 GMT Article-I.D.: world.1991Jun24.122927.4187 References: <1991Jun21.121344.13733@doug.cae.wisc.edu> Distribution: usa Organization: The World Public Access UNIX, Brookline, MA Lines: 26 In article <1991Jun21.121344.13733@doug.cae.wisc.edu> jverdega@cae.wisc.edu (Jeffrey Verdegan) writes: >Hi all, > >Just a quick question here. When calling > >SetIText(itemHandle, tmpStr);, > >does the Str255 that is the item's text point directly to tmpStr, or are >tmpStr's contents copied into the existing Str255, thereby leaving two separate >copies of tmpStr? I believe the answer here is YES. It does copy the string. When setting the text, remember that static and edit text in dialogs are part of the item list. When you call SetIText you are adjusting the contents of the handle to the item list. And it is just as well that this is so, since I find myself often writing quick subroutines where the string is a local to contain a converted number from NumToString, as such if that local where the only container for that string I would loose it, and possibly crash later, when the subroutine returned. -- Andrew E. Page (Warrior Poet) | Decision and Effort The Archer and Arrow Concepts Enginerring | The difference between what we are Macintosh and DSP Technology | and what we want to be.