ftp.nice.ch/peanuts/GeneralData/Usenet/news/1989/CSN-89.tar.gz#/comp-sys-next/1989/May-Jun/Question-about-Text-methods

This is Question-about-Text-methods in view mode; [Up]


Date: Sun 01-May-1989 21:58:53 From: Unknown Subject: Question about Text methods 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: { 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 >From: roy@prism.gatech.EDU (Roy Mongiovi)

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Marcel Waldvogel and Netfuture.ch.