Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!europa.asd.contel.com!gatech!mcnc!duke!physics.phy.duke.edu!fang From: fang@physics.phy.duke.edu (Fang Zhong) Newsgroups: comp.sys.mac.programmer Subject: How to save editable text in dialog for next launch? Message-ID: <22375@duke.cs.duke.edu> Date: 8 Jun 91 19:43:13 GMT Sender: news@duke.cs.duke.edu Reply-To: fang@physics.phy.duke.edu (Fang Zhong) Organization: Duke University Physics Dept.; Durham, N.C. Lines: 74 Nntp-Posting-Host: physics.phy.duke.edu I want to save the editable texts in my dialog for next launch. I need some help to get it work. Here is my source: _____________________________________________________________________ typedef union res_select { unsigned long RType; unsigned char cRType[4]; } res_select; void main(void) { short item, itype; Boolean done = false; Rect box; Handle ithdl, ditl_hdl; DialogPtr Dptr; char string[80]; res_select type_res; ResType res_type; InitGraf((Ptr) &qd.thePort); InitFonts(); InitWindows(); InitMenus(); TEInit(); InitDialogs(nil); Dptr = GetNewDialog(155, nil, (WindowPtr)-1); while(!done) { ModalDialog(nil, &item); switch(item) { case 1: /* OK */ done = true; break; case 2: /* Cancel */ done = true; break; default: break; } } GetDItem(Dptr, 3, &itype, &ithdl, &box); /* Editable Text */ GetIText(ithdl, string); p2cstr(string); printf("%s\n", string); strncpy(type_res.cRType, "DITL", 4); res_type = type_res.RType; ditl_hdl = Get1Resource(res_type, 4877); /* I got a handle for the Item Lists, Inside Mac told me that only the copy of item list read from resource file was used after GetNewDialog was called. How can I find this copy in the memory and link the above handle to it? Then I only need to use the following line to update my dialog for next launch. */ ChangedResource(ditl_hdl); DisposDialog(Dptr); } ___________________________________________________________________ Thanks for any help in advance. -- Fang Zhong 1-919-684-8247 Duke University Dept. of Physics fang@phy.duke.edu Durham, N.C. 27706