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

  1. Newsgroups: comp.sys.next.programmer
  2. Path: sparky!uunet!paladin.american.edu!darwin.sura.net!cs.utk.edu!ornl!usenet
  3. From: woo@ornl.gov (John W. Wooten)
  4. Subject: RTFD, copying to Objects and Archiving
  5. Message-ID: <1993Jan7.213019.7023@ornl.gov>
  6. Sender: usenet@ornl.gov (News poster)
  7. Reply-To: woo@ornl.gov
  8. Organization: Oak Ridge National Laboratory
  9. Date: Thu, 7 Jan 1993 21:30:19 GMT
  10. Lines: 55
  11.  
  12. I am working on an application where I compose questions
  13. that will contain rich text (including diagrams).  I have a simple  
  14. subclass of Object called QuestionObj that I create an instance of for  
  15. each question and then maintain the questions in a List Object.
  16.  
  17. The text is in a text field with id "text".
  18.  
  19. I try to do the following:
  20.     NXStream *buffer;
  21.     
  22.     count = [questions count];
  23.     newQuestion = [[QuestionObj alloc] init];
  24.     buffer = NXOpenMemory(NULL,0,NX_WRITEONLY);
  25.     [text writeRTFDTo:buffer];
  26.     [newQuestion setText:buffer];
  27.  
  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.  
  45. - setNum:(int)val;
  46. - (int)num;
  47. - setText:(NXStream *)str;
  48. - (NXStream *)text;
  49.  
  50. Now, first it appears that I'm not getting the Rich Text because I  
  51. can't get it back out of the object with text method.
  52.  
  53. I know most of this works with ascii text (I tried this all out using  
  54. char *buffer;
  55. first)
  56.  
  57. Also, if this even works, in the -read -write methods of the
  58. QuestionObj class, what do I put for the descriptor when I use
  59. NXWriteTypedStreamToFile ?
  60. I used a * when it was a char * and it worked.
  61.  
  62. What do I put for a typed stream?
  63.  
  64.  
  65. - - - - - - - - -
  66. J. W. Wooten
  67.