fang@physics.phy.duke.edu (Fang Zhong) (06/09/91)
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