Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!psuvax1!psuvm.bitnet!bsd From: BSD@PSUVM.BITNET (Scott Dickson) Newsgroups: comp.sys.next Subject: Question about Text methods Message-ID: <89121.175854BSD@PSUVM> Date: 1 May 89 21:58:53 GMT Organization: Penn State University - Center for Academic Computing Lines: 42 I am having trouble using my own filters with a Text object. I am starting with Lab3 from the developers course as a basis. What I want to do is to be able to read in data from a file, put it into a TextView, but be able to filter it as it is read in. I want to be able to basically find and filter out markers from a plain text file. So, I started into the newText: method of TextView.m in Lab3. I made the following changes to the code: -newText: (NXRect *) tF { int fd; NXStream *stream; /* set up text same as before */ [text setTextFilter: (NXTextFunc) myTextFilter]; fd = open("Makefile",O_RDONLY,0); stream = NXOpenFile(fd,NX_READONLY); /* do rest of initialization, including setting character filter */ [text readText: stream]; return text; } Now, the manual says that the text filter is used for input from the keyboard, the pasteboard, or a file. But, it doesn't get called until I start doing keyboard input. The textView is created just fine, complete with text from the file, but the filter is never called. All the filter does is echo its input to stdout. Once the view is initialized with the text, the text filter is called for each timer interval, I suppose. It's not quite each keystroke, since sometimes I can type fast enough to get two. That makes me somewhat suspect about the text filter in general. So, how can I get text that I am reading in from a file into a Text object to pass through its textfilter? --SCott Dickson