Path: utzoo!attcan!uunet!samsung!usc!apple!bbn!husc6!bochner From: bochner@babbage.harvard.edu (Harry Bochner) Newsgroups: comp.sys.mac.programmer Subject: Re: Two Windows, Same Text, Howtodoit? Message-ID: Date: 21 Feb 90 20:09:54 GMT References: <3210@dogie.macc.wisc.edu> Sender: news@husc6.harvard.edu Organization: Aiken Computation Lab, Harvard University Lines: 28 In-reply-to: yahnke@vms.macc.wisc.edu's message of 19 Feb 90 04:20:39 GMT In article <3210@dogie.macc.wisc.edu> yahnke@vms.macc.wisc.edu (Ross Yahnke, MACC) writes: I'm working on an app that will sometimes have two different windows contain the same text. I want both windows to be editable, with changes in one reflected instantaneously in the other, sort of like the split-screen effect in MS-Word or Nisus. Using standard TE calls, what's a good way to do this? Should I declare a seperate TEHandle for each window and keep the text within in synch by sending TEKey's to both? Or should I just have 1 TEHandle? Here's a variation on the 2 TEHandle idea that might be worth trying: Instead of passing a duplicate of each TEKey, TEClick, etc. to the inactive handle, use the lower level routines TEInsert, TEDelete, etc. The code will be trickier to write, but I suspect it will be less kludgy. You probably don't even have to keep the insertion points the same; in fact I expect most applications with independent windows would want the insertion points to be independent. Instead you figure out where to do the TEInsert by looking at the value of TEselStart in the active Handle. That way you don't have to pass on arrow keys at all, eliminating the specific problem you mentioned. Again, each approach has its headaches, and I'm not sure how they'll balance out, but it might be worth a try. -- Harry Bochner bochner@endor.harvard.edu