[comp.sys.next] rich text problem

dorner@pequod.cso.uiuc.edu (Steve Dorner) (03/18/89)

I'm writing some code that uses a ScrollView to scroll a Text object around.
I have a method, readDrivel, that reads the text in and sets things up.  Here
it is:

  - readDrivel:(char *)fileName
  {
    NXStream *nxs;
    int fd;
    float w,h;
    NXRect frm;
    
    if ((fd=open(fileName,O_RDONLY))>=0 && (nxs = NXOpenFile(fd,"r")))
    {
      [theText readText:nxs];
      [theText getMinWidth:&w minHeight:&h
	maxWidth:bounds.size.width maxHeight:1.0e38];
      [theText sizeTo:bounds.size.width
	:(h>bounds.size.height-5 ? h : bounds.size.height-5)];
      [self display];
      NXClose(nxs);
      close(fd);
    }
    return self;
  }

It works like a charm.  My problem is when I change "readText" to
"readRichText".  I then get my text, nicely formatted and fonted, but I fail
to get a scroller; it acts as though the text is no bigger than the ScrollView,
although it is quite long.  Gdb reports the heights above as:

  Bpt 1, -[PhView readDrivel: fileName=(STR) 0x894c "Introduction.rtf"] (PhView.m line 33)
  33	      :(h>bounds.size.height-5 ? h : bounds.size.height-5)];
  (gdb) print w
  $1 = 5
  (gdb) print h
  $2 = 538
  (gdb) print bounds.size
  $3 = {  
    width = 289;
    height = 145;
  }

I have a perfectly valid rich text file, and get no errors during readRichText.
I have tried all sorts of incantations along the lines of what was done in
the "TextView" class in Lab 3 of the Developer's class, all to no avail.
And I repeat, the code works JUST FINE if I use readText in place of
readRichText (of course, the output isn't quite as pretty :-)).

Anybody out there who would like to shed some light into my poor benighted
soul?

Steve
-- 
Steve Dorner, U of Illinois Computing Services Office
Internet: dorner@garcon.cso.uiuc.edu  UUCP: {convex,uunet}!uiucuxc!dorner
IfUMust:  (217) 244-1765