Xref: utzoo comp.lang.c:36828 comp.sys.mac.programmer:22409 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!psuvax1!psuvm!eao102 From: EAO102@psuvm.psu.edu (Ernie Oporto) Newsgroups: comp.lang.c,comp.sys.mac.programmer Subject: Re: ThinkC program--why wont it work? Message-ID: <91065.143433EAO102@psuvm.psu.edu> Date: 6 Mar 91 19:34:32 GMT References: <91064.120155EAO102@psuvm.psu.edu> Organization: Penn State University Lines: 174 OK......here's more of a problem. I inserted the following lines inside of the create_t_window function: WIND *t_windinfo; WindowPtr t_window; That seemed to have cleared up my problems with their being declared, but now ThinkC is telling me that my #included files can't be openned. Now what am I doing wrong? Below is the source code: /*** generic main event loop ***/ #include "WindowMgr.h" #include "EventMgr.h" #include "QuickDraw.h" void mainevent() { EventRecord event; while(1) /* forever */ { GetNextEvent(everyEvent,&event); switch (event.what) { case mouseDown: do_mousedown(event); break; case keyDown: case autoKey: do_keydown(event); break; case activateEvt: do_activate(event); break; case updateEvt: do_update(event); break; default: do_idle(); break; } } } /*** window info structure ***/ typedef struct wind { char dirty; /* contents saved? */ char zoom; /* window "zoomed"? */ void **data; /* window contents */ /* window messages/methods */ void (*activateproc)(); void (*updateproc)(); void (*keydownproc)(); void (*contentproc)(); void (*goawayproc)(); void (*growproc)(); void (*zoomproc)(); void (*idleproc)(); void (*disposeproc)(); void (*cutproc)(); void (*copyproc)(); void (*pasteproc)(); void (*clearproc)(); void (*findproc)(); } WIND; /*** text window creation function ***/ void create_t_window(title,wrect,closebox) char *title; Rect wrect; int closebox; { /* ... */ WIND *t_windinfo; WindowPtr t_window; /* allocate new window info */ t_windinfo = (WIND *)NewPtr(sizeof(WIND)); /* allocate new window */ t_window = NewWindow(NIL,&wrect,title,TRUE,8,FRONT,closebox,NIL); /* ... */ /* insert window methods */ t_windinfo->activateproc = t_activate; t_windinfo->updateproc = t_update; t_window->keydown = t_keydown; /* etc... */ /* insert info into window refCon */ SetWRefCon(t_window,t_windinfo); } /***text window activate method ***/ void t_activate(window,windinfo) WindowPtr window; WIND *windinfo; { TEHandle tehandle; /* get data handle */ tehandle = (TEHandle)windinfo->data; /* activate event */ if(event.modifiers & activeFlag) { TEActive(tehandle); HiliteControl(((WindowPeek) window) ->controlList,ENABLE); TEFromScrap(); enable_edit((**tehandle).selEnd - (**tehandle).selStart); enable_find(); } else /* deactivate event */ { TEDeactivate (tehandle); HiliteControl(((WindowPeek) window) ->controlList,DISABLE); ZeroScrap(); TEToScrap(); disable_edit(): disable_find(); } } /*** activate message dispatcher ***/ void do_activate(event) EventRecord event; { WindowPtr window; WIND *windinfo; window = (WindowPtr)event.message; windinfo = (WIND *)GetWRefCon(window); (*windinfo->activateproc)(window,windinfo); } /*** Macintosh application ***/ main() { /* Mac specific initialization */ init_mac(); /* set up application menus */ setup_menus(); /* etc... */ /* call main event loop */ mainevent(); }