home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.next.programmer
- Path: sparky!uunet!psinntp!relief!jjfeiler
- From: jjfeiler@relief.com (John Jay Feiler)
- Subject: Re: RTFD, copying to Objects and Archiving
- Message-ID: <1993Jan11.062406.9249@relief.com>
- Sender: jjfeiler@relief.com
- Reply-To: jjfeiler@relief.com
- Organization: relief consulting
- References: <1993Jan7.213019.7023@ornl.gov>
- Date: Mon, 11 Jan 1993 06:24:06 GMT
- Lines: 68
-
- In article <1993Jan7.213019.7023@ornl.gov> woo@ornl.gov (John W. Wooten)
- writes:
- > I am working on an application where I compose questions
- > that will contain rich text (including diagrams). I have a simple
- > subclass of Object called QuestionObj that I create an instance of for
- > each question and then maintain the questions in a List Object.
- >
- > The text is in a text field with id "text".
- >
- > I try to do the following:
- > NXStream *buffer;
- >
- > count = [questions count];
- > newQuestion = [[QuestionObj alloc] init];
- > buffer = NXOpenMemory(NULL,0,NX_WRITEONLY);
- > [text writeRTFDTo:buffer];
- > [newQuestion setText:buffer];
- >
- > Now in the QuestionObj, I have:
- > - setText:(NXStream *)str
- > {
- > buffer = str;
- > return self;
- > }
- > - (NXStream *)text
- > {
- > return buffer;
- > }
- > with interface of:
- > @interface QuestionObj:Object
- > {
- > int num;
- > NXStream *buffer;
- > }
- >
- > - setNum:(int)val;
- > - (int)num;
- > - setText:(NXStream *)str;
- > - (NXStream *)text;
- >
- > Now, first it appears that I'm not getting the Rich Text because I
- > can't get it back out of the object with text method.
- >
- > I know most of this works with ascii text (I tried this all out using
- > char *buffer;
- > first)
- >
- > Also, if this even works, in the -read -write methods of the
- > QuestionObj class, what do I put for the descriptor when I use
- > NXWriteTypedStreamToFile ?
- > I used a * when it was a char * and it worked.
- >
- > What do I put for a typed stream?
- >
- >
- > - - - - - - - - -
- > J. W. Wooten
-
-
- Just a guess, but are you doing a NXSeek(buffer, 0L, NX_FROMSTART) before
- trying to access data in the stream?
-
- John
-
- --
- John Feiler jjfeiler@relief.com
- 4926 152nd St. SW NeXTmail Welcome!!!
- Edmonds, WA 98026-3344 Independent NeXTSTEP Developer
-