home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / next / programm / 5849 < prev    next >
Encoding:
Internet Message Format  |  1992-08-29  |  2.0 KB

  1. Path: sparky!uunet!gatech!prism!xray.gatech.edu!cc100aa
  2. From: cc100aa@xray.gatech.edu (Ray Spalding)
  3. Newsgroups: comp.sys.next.programmer
  4. Subject: Re: SCROLLVIEW DESPERADO
  5. Keywords: documentView, NXImage, Please Help because Hyperupic wants new features
  6. Message-ID: <67172@hydra.gatech.EDU>
  7. Date: 29 Aug 92 02:06:24 GMT
  8. References: <1992Aug24.180943.16637@Princeton.EDU>
  9. Sender: news@prism.gatech.EDU
  10. Organization: Georgia Institute of Technology
  11. Lines: 48
  12.  
  13. In article <1992Aug24.180943.16637@Princeton.EDU>  writes:
  14. >Hello again!  I will try another plea for some ScrollView wisdom:
  15. > [...]
  16. >  anImageView = [[ImageView alloc] init];
  17.  
  18. Notice that the "init" method for a View makes a zero-by-zero frame
  19. rectangle.  If you're going to use "init" rather than "initFrame",
  20. you'll need to use "sizeTo::" later on.
  21.  
  22. >  [contentView drawSelf:&imageRect :1];
  23.  
  24. Don't call drawSelf:: directly.  Use one of the "display" methods.
  25.  
  26. >- drawSelf:(const NXRect *)rects :(int)rectCount {
  27. >  [super drawSelf:rects :rectCount];
  28. >  [contentView drawSelf:&imageRect :1];
  29. >  return self;
  30. >}
  31.  
  32. You don't need the above.  The "display" machinery will call "drawSelf::"
  33. for the Views needed.
  34.  
  35. >- setpict: (char *) path {
  36. >  if ( [imagerep useFromFile:path] == NO )
  37. >    return nil;
  38. >  return self;
  39. >}
  40.  
  41. In the above, you could add:
  42.     NXSize sz;
  43.     /* ... */
  44.     [imagerep getSize:&sz];
  45.     [self sizeTo:sz.width:sz.height];
  46.  
  47. It might be more straightforward, though, to redesign all this so
  48. that you get your NXImage (and it's size) before you allocate and
  49. initialize the ImageView.
  50.  
  51. >- drawSelf:(const NXRect *)rects :(int)rectCount {
  52. >  [imagerep composite:NX_COPY fromRect:rects toPoint:&(rects->origin)];
  53.  
  54. "composite:fromRect:toPoint" is intended to composite a sub-rectangle
  55. of your image.  Better here to use:
  56.     [imagerep composite:NX_COPY toPoint:&bounds.origin];
  57. -- 
  58. Ray Spalding, Office of Information Technology
  59. Georgia Institute of Technology, Atlanta Georgia, 30332-0715
  60. Internet: ray.spalding@oit.gatech.edu (NeXT Mail accepted)
  61.