home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / next / programm / 8061 < prev    next >
Encoding:
Text File  |  1993-01-11  |  2.2 KB  |  81 lines

  1. Newsgroups: comp.sys.next.programmer
  2. Path: sparky!uunet!psinntp!relief!jjfeiler
  3. From: jjfeiler@relief.com (John Jay Feiler)
  4. Subject: Re: RTFD, copying to Objects and Archiving
  5. Message-ID: <1993Jan11.062406.9249@relief.com>
  6. Sender: jjfeiler@relief.com
  7. Reply-To: jjfeiler@relief.com
  8. Organization: relief consulting
  9. References: <1993Jan7.213019.7023@ornl.gov>
  10. Date: Mon, 11 Jan 1993 06:24:06 GMT
  11. Lines: 68
  12.  
  13. In article <1993Jan7.213019.7023@ornl.gov> woo@ornl.gov (John W. Wooten)  
  14. writes:
  15. > I am working on an application where I compose questions
  16. > that will contain rich text (including diagrams).  I have a simple  
  17. > subclass of Object called QuestionObj that I create an instance of for  
  18. > each question and then maintain the questions in a List Object.
  19. > The text is in a text field with id "text".
  20. > I try to do the following:
  21. >     NXStream *buffer;
  22. >     
  23. >     count = [questions count];
  24. >     newQuestion = [[QuestionObj alloc] init];
  25. >     buffer = NXOpenMemory(NULL,0,NX_WRITEONLY);
  26. >     [text writeRTFDTo:buffer];
  27. >     [newQuestion setText:buffer];
  28. > Now in the QuestionObj, I have:
  29. > - setText:(NXStream *)str
  30. > {
  31. >     buffer = str;
  32. >     return self;
  33. > }
  34. > - (NXStream *)text
  35. > {
  36. >     return buffer;
  37. > }
  38. > with interface of:
  39. > @interface QuestionObj:Object
  40. > {
  41. >     int num;
  42. >     NXStream *buffer;
  43. > }
  44. > - setNum:(int)val;
  45. > - (int)num;
  46. > - setText:(NXStream *)str;
  47. > - (NXStream *)text;
  48. > Now, first it appears that I'm not getting the Rich Text because I  
  49. > can't get it back out of the object with text method.
  50. > I know most of this works with ascii text (I tried this all out using  
  51. > char *buffer;
  52. > first)
  53. > Also, if this even works, in the -read -write methods of the
  54. > QuestionObj class, what do I put for the descriptor when I use
  55. > NXWriteTypedStreamToFile ?
  56. > I used a * when it was a char * and it worked.
  57. > What do I put for a typed stream?
  58. > - - - - - - - - -
  59. > J. W. Wooten
  60.  
  61.  
  62. Just a guess, but are you doing a NXSeek(buffer, 0L, NX_FROMSTART) before  
  63. trying to access data in the stream?  
  64.  
  65.     John
  66.  
  67. --
  68. John Feiler                             jjfeiler@relief.com
  69. 4926 152nd St. SW                       NeXTmail Welcome!!!
  70. Edmonds, WA  98026-3344      Independent NeXTSTEP Developer 
  71.