home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 (1993) / nebula.bin / SourceCode / MiniExamples / PerformanceTuning / VisibleView-02 / Appender.m < prev    next >
Encoding:
Text File  |  1991-10-18  |  979 b   |  37 lines

  1. //
  2. //    An Object to Append Text to IB's Default ScrollView
  3. //    Randy Nelson—Copyright NeXT Computer, Inc 1990 All Rights Reserved
  4. //    Created 5-1-90
  5. //    Modified 9-3-90 -- Removed outlet initializers.
  6. //
  7. //    You may freely copy, distribute and reuse the code in this example.
  8. //    NeXT disclaims any warranty of any kind, expressed or implied, as to
  9. //    its fitness for any particular use.
  10. //
  11.  
  12. #import "Appender.h"
  13. #import <appkit/ScrollView.h>
  14. #import <appkit/Text.h>
  15.  
  16. @implementation Appender
  17.  
  18. //prints the doc view of the scroll view
  19. - print:sender
  20. {
  21.     [[scrollView docView] printPSCode:self];
  22.     return self;
  23. }
  24.  
  25. //appends the string passed to the doc view of the scroll view
  26. - appendToText:(const char *)newText
  27. {
  28.     int        currentLength;
  29.     
  30.     currentLength = [[scrollView docView] textLength];
  31.     [[scrollView docView] setSel:currentLength :currentLength];
  32.     [[scrollView docView] replaceSel:newText];
  33.     [[scrollView docView] scrollSelToVisible];
  34.     return self;
  35. }
  36. @end
  37.