[Newbies] How do I print?
cunningham.cb at gmail.com
Mon Aug 24 05:08:20 UTC 2015
On Sun, Aug 23, 2015 at 4:43 PM, Kirk Fraser <overcomer.man at gmail.com>
> 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?
You can fix this by copying the following into the SmalltalkEditor class.
| 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]
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
The above message also shows how to programmatically interface with the
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners