ftp.nice.ch/peanuts/GeneralData/Usenet/news/1989/CSN-89.tar.gz#/comp-sys-next/1989/Jan-Apr/rich-text-problem

This is rich-text-problem in view mode; [Up]


Date: Sun 17-Mar-1989 17:21:32 From: Unknown Subject: rich text problem 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

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Marcel Waldvogel and Netfuture.ch.