Print outs of Richtext Streams 
Author Message
 Print outs of Richtext Streams

Dear all,

Does anybody has experiences in printing of RichText Streams on a local
printer ?
In fact, I have absolutely no idea how to manage this proceesing-

John



Wed, 17 Mar 2004 15:56:12 GMT  
 Print outs of Richtext Streams
John,

Quote:
> Does anybody has experiences in printing of RichText Streams on a local
> printer ?
> In fact, I have absolutely no idea how to manage this proceesing-

If you are using D4 then there's a goodie available from my web site that
will do this. It's mainly aimed at printing the contents of RichTextEdits
(i.e. the Windows control) but it can be used to print arbitrary RTF strings
and RichText instances as well.

r := RichTextEdit new
    parentView: View desktop;
    create;
    rtfText: '{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Times New
Roman;}}
\viewkind4\uc1\pard\lang2057\f0\fs22 hello
\par }';
    print

That will open up a printer selection dialog and then output the rtf text to
the selected printer. You can also set certain parameters beforehand (title,
margins) using the "PrintSetup" key added to Dolphin Options

Ian

http://www.iandb.org.uk



Wed, 17 Mar 2004 17:03:46 GMT  
 Print outs of Richtext Streams
Ian,

Thank you for the hints. I have a taken a look at your packages and I
learned a lot.
Why are you guys so cunning ?
I also understand by looking at DOCVIEW>>lpszDocName: that not all methods
must explicitely been defined to understand a message, although, it seems
strange.

John

Ian Bartholomew schrieb in Nachricht

Quote:
>John,

>> Does anybody has experiences in printing of RichText Streams on a local
>> printer ?
>> In fact, I have absolutely no idea how to manage this proceesing-

>If you are using D4 then there's a goodie available from my web site that
>will do this. It's mainly aimed at printing the contents of RichTextEdits
>(i.e. the Windows control) but it can be used to print arbitrary RTF
strings
>and RichText instances as well.

>r := RichTextEdit new
>    parentView: View desktop;
>    create;
>    rtfText: '{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Times New
>Roman;}}
>\viewkind4\uc1\pard\lang2057\f0\fs22 hello
>\par }';
>    print

>That will open up a printer selection dialog and then output the rtf text
to
>the selected printer. You can also set certain parameters beforehand
(title,
>margins) using the "PrintSetup" key added to Dolphin Options

>Ian

>http://www.iandb.org.uk



Sun, 21 Mar 2004 15:18:03 GMT  
 Print outs of Richtext Streams
John,

Quote:
> I also understand by looking at DOCVIEW>>lpszDocName: that not all methods
> must explicitely been defined to understand a message, although, it seems
> strange.

This only applies to subclasses of ExternalStructure. The idea is that as
you can define the structure of the object that the class is representing
(see all the class side #defineFields messages) then you can also define the
methods dynamically when they are needed. This is mainly done as a means of
reducing the size of the image and avoiding the need for writing lots of
rarely used accessor methods.

As an example, add a new class, Test, as a subclass of Win32Structure and
give it one _class_ side method

defineFields
    self
        defineField: #tom type: DWORDField new;
        defineField: #dick type: DWORDField new;
        defineField: #harry type: DWORDField new

There are no instance methods in the class but evaluating

Test new tom

correctly answers the value of the #tom field (initially 0). What happens is
that a #doesNotUnderstand error is raised when you send #tom to the Test
instance. Normally this will generate a walkback, the one you see whenever
you use an unknown selector, but ExternalStructure prevents this. Instead it
looks through the structure definition (given in #defineFields) and if it
finds a matching field it automatically evaluates some code that performs
the correct accessor function.  If it can't find a matching field it just
continues with the #doesNotUnderstand error.

Because this operation can be expensive Dolphin also provides a means of
creating the correct methods from the template. If you evaluate

Test compileDefinition

then all the accessor instance methods for Test will magically appear.

There is a lot more to this but the above is a rough idea. You might also
want to have a look in the EducationCentre section (Dolphin Developers
Guide - External Interfacing - External Structures)

Regards
    Ian



Sun, 21 Mar 2004 16:40:08 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Pretty printing streams and *print-right-margin* modification

2. smalltalk newbie : printing on Transcript Stream

3. Problem mixing print_exc and print in one file stream

4. print statement, hex stream, linefeed

5. printing/reading CLOS objects in streams

6. Richtext

7. Microsoft RichText control?

8. RichText OCX and Scrollbars

9. RICHText OCX on IMB PC

10. RichText to WMF

11. MIME richtext in a TK text widget

12. Adding/Removing Streams from a Broadcast Stream

 

 
Powered by phpBB® Forum Software