[Newbies] [squeak-dev] ColorTranscript howto fake/implement?

Marcel Taeumel marcel.taeumel at hpi.de
Thu May 16 10:20:47 UTC 2019


Hi, there.

That's not how to use text attributes. There is TextColor for setting a text's color. Try this:

text := Text string: 'text' attribute: (TextColor color: Color red).
Transcript show: text;cr.

Best,
Marcel
Am 16.05.2019 11:41:53 schrieb LawsonEnglish <lenglish5 at cox.net>:
Hmmm. Doesn’t seem to work. Eventually opens up an uncountable number of MNU windows

Transcript := TranscriptStream new.

text := Text string: 'text' attribute: (Color red).

Transcript show: text;cr



16 May 2019 2:39:05.027292 am

VM: Mac OS - Smalltalk
Image: Squeak5.2 [latest update: #18229]

SecurityManager state:
Restricted: false
FileAccess: true
SocketAccess: true
Working Dir /Applications/Squeak5.2-18229-64bit copy.app/Contents/Resources
Trusted Dir /Users/lawson/Library/Application Support/Squeak/
Untrusted Dir /Users/lawson/Documents/Squeak/

Color(Object)>>doesNotUnderstand: #emphasizeScanner:
Receiver: Color red
Arguments and temporary variables: 
aMessage: emphasizeScanner: a CharacterBlockScanner
exception: MessageNotUnderstood: Color>>emphasizeScanner:
resumeValue: nil
Receiver's instance variables: 
rgb: 1072693248
cachedDepth: 32
cachedBitPattern: a Bitmap of length 1

[…]

--- The full stack ---
Color(Object)>>doesNotUnderstand: #emphasizeScanner:
[] in CharacterBlockScanner(CharacterScanner)>>setFont
Array(SequenceableCollection)>>do:
CharacterBlockScanner(CharacterScanner)>>setFont
CharacterBlockScanner>>setFont
CharacterBlockScanner(CharacterScanner)>>setStopConditions
CharacterBlockScanner>>characterBlockAtPoint:index:in:
NewParagraph>>characterBlockForIndex:
SmalltalkEditor(TextEditor)>>markIndex:pointIndex:
SmalltalkEditor(Editor)>>selectInvisiblyFrom:to:
SmalltalkEditor(TextEditor)>>selectFrom:to:
SmalltalkEditor(Editor)>>selectInterval:
PluggableTextMorphPlus(PluggableTextMorph)>>mouseEnter:
PluggableTextMorphPlus(Morph)>>handleMouseEnter:
MouseButtonEvent(MouseEvent)>>sentTo:
MouseButtonEvent>>sentTo:
PluggableTextMorphPlus(Morph)>>handleEvent:
[] in MouseOverHandler>>processMouseOver:
Array(SequenceableCollection)>>reverseDo:
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MouseOverHandler>>processMouseOver:
HandMorph>>processEvents
[] in WorldState>>doOneCycleNowFor:
Array(SequenceableCollection)>>do:
WorldState>>handsDo:
WorldState>>doOneCycleNowFor:
WorldState>>doOneCycleFor:
PasteUpMorph>>doOneCycle
[] in MorphicProject>>spawnNewProcess
[] in BlockClosure>>newProcess


On May 16, 2019, at 1:14 AM, Marcel Taeumel <marcel.taeumel at hpi.de [mailto:marcel.taeumel at hpi.de]> wrote:

Hi Lawson,

please find attached a changeset that adds text support to TranscriptStream. You have to replace your transcript with "Transcript := TranscriptStream new".

Best,
Marcel
Am 15.05.2019 20:35:00 schrieb LawsonEnglish <lenglish5 at cox.net [mailto:lenglish5 at cox.net]>:
I’m trying to implement something along the lines of:

ColorTranscript show: ‘text’ withColor: Color red; show: ‘more text’ withColor: Color blue.

All stream classes seem to strip out text attribute information except AttributedTextStream which seems rather incomplete.

I was thinking that I could analyze how the color menu that is accessed via cmd-6 (on the mac) is able to colorize a selection even in a transcript window and so implement the functionality by faking the UI’s steps, but I can’t figure out how to debug the interface and trace though a menu call to see what it actually does.

Any suggestions?

on how to trace the steps to colorize a word via the menu OR on how to implement the functionality directly…

Either/both would be appreciated,

Thanks.


Lawson


<color-transcript.1.cs>_______________________________________________
Beginners mailing list
Beginners at lists.squeakfoundation.org [mailto:Beginners at lists.squeakfoundation.org]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20190516/4a9a5833/attachment-0001.html>


More information about the Beginners mailing list