Print outs of Richtext Streams

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Print outs of Richtext Streams

FU Berlin
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


Reply | Threaded
Open this post in threaded view
|

Re: Print outs of Richtext Streams

Ian Bartholomew-5
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


Reply | Threaded
Open this post in threaded view
|

Re: Print outs of Richtext Streams

FU Berlin
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
<9p42tj$gcf7o$[hidden email]>...
>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
>
>
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Print outs of Richtext Streams

Ian Bartholomew-5
John,

> 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