On Sun, Aug 23, 2015 at 4:43 PM, Kirk Fraser <overcomer....@gmail.com>
wrote:

> Several different things are polymorphically called print.  How do I send
> text to a peripheral printer?  I found the menu item "Send contents to
> printer" and it produced walkback which says
> "MessageNotUnderstood: SmalltalkEditor>sendContentsToPrinter".  Printer
> setup similarly failed yet after the OS supplied the customary sound that
> the printer was hooked up.
>
> This occurred in Squeak 4.5 under Windows 7.  What would solve the problem
> best?  Upgrading Squeak?  Getting a different printer? Going back to
> Digitalk Smalltalk/V and a dot matrix ribbon printer where it did work
> years ago?
>
> Kirk
>

Hi Kirk,
You can fix this by copying the following into the SmalltalkEditor class.

sendContentsToPrinter
| textToPrint printer parentWindow |
textToPrint := paragraph text.
textToPrint size = 0 ifTrue: [^self inform: 'nothing to print.'].
printer := TextPrinter defaultTextPrinter.
parentWindow := self model dependents
detect: [:dep | dep isSystemWindow]
ifNone: [nil].
parentWindow isNil
ifTrue: [printer documentTitle: 'Untitled']
ifFalse: [printer documentTitle: parentWindow label].
printer printText: textToPrint

this will send the contents of an editor pane to the connected (default)
printer.  If you need to change the printer, you can go to the outside top
left icon (mouse), choose VM Preferences->System Preferences->Printer
Configuration.

The above message also shows how to programmatically interface with the
printer.

-cbc
_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to