Article View: comp.sys.next.programmer
Article #596-=?=- dumping text into an invisible text object -=?=-
From: Charles Herrick
Date: Thu, 09 Apr 1992 19:55
Date: Thu, 09 Apr 1992 19:55
48 lines
1876 bytes
1876 bytes
Bubalah's,
I've got some email out on this, but it's driving me crazy so ...
I'd like to shove a selected section from one Text object into another so
I can send the "invisible" target Text object a printPSCode: message and
get the effect of printing selected text. The source Text object lives in
a ScrollView, is straight off IB's palette (i.e. setMonoFont:NO) and is:
docView = [myScrollView docView];
here's code:
BEGIN--CUT HERE--
{
NXSelPt start, end;
int length;
[docView getSel:&start :&end];
length = end.cp - start.cp;
if (length) // something selected, print it
{
id textObject;
NXStream *stream;
NXRect frameRect = {0.0,0.0,1.0,1.0};
// get an NXStream
stream = NXOpenMemory(NULL,0,NX_READWRITE);
// and dump from source Text object
[docView writeRichText:stream from:start.cp to:end.cp];
// get an invisible target Text object. Am I lost here?
textObject = [[[Text alloc]
initFrame:&frameRect]
setMonoFont:NO];
// dump into the text object
[textObject readRichText:stream];
NXClose(stream);
[textObject printPSCode:self];
[textObject free];
}
}
END--CUT HERE--
Now here's what happens ... in Gdb, after the readRichText: message to
textObject, sending [textObject byteLength] replies 1. And indeed a blank
page gets printed. I've noodled around with stream->buf_base, and there is
indeed stuff in the NXStream.
Help??
Chuck Herrick <cnh5730@maraba.tamu.edu>
Technical Details
Message-ID:
<12092@tamsun.tamu.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!tamsun!maraba.tamu.eduShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!tamsun!maraba.tamu.edu From: cnh5730@maraba.tamu.edu (Charles Herrick) Newsgroups: comp.sys.next.programmer Subject: -=?=- dumping text into an invisible text object -=?=- Message-ID: <12092@tamsun.tamu.edu> Date: 9 Apr 92 19:55:58 GMT Sender: usenet@tamsun.tamu.edu Lines: 48