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 _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
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
_______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
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
_______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Hey, thanks.
I don’t know what was wrong. I downloaded a pristine copy and filed-in and it works now using your method My wrong-way apparently made things permanently wacky or maybe something I did earlier in the same image was the culprit. Thanks again, Lawson By the way, will this be part of the distribution soon? It's probably going to be very useful for a lot of people once they get used to it. L
_______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Hi, I was passing by, and tried : ---- text := Text string: 'text example ' attribute: (TextColor color: Color red). Transcript show: text;cr. ---- In Squeak5.2 MacOS Mojave. It does not work properly, the text comes out black as usual. bye Nicola -- Sent from: http://forum.world.st/Squeak-Beginners-f107673.html _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Hi Nicola!
* Nicola Mingotti <[hidden email]> [190725 23:37]: > > > Hi, > > I was passing by, and tried : > > ---- > text := Text string: 'text example ' attribute: (TextColor color: Color > red). > Transcript show: text;cr. If you browse the TranscriptStream's show: procedure you'll see that it will send asString to the object you hand in, so in you case the attributes of the Text get ignored as asString on Text will just return the content's string. So out of the box a colorized Transcript isn't possible. Kind regards, Christian -- May you be peaceful, may you live in safety, may you be free from suffering, and may you live with ease. _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Hi Christian, ok, I guess see the point. thanks bye Nicola > On Jul 26, 2019, at 9:39 AM, Christian Kellermann <[hidden email]> wrote: > > Hi Nicola! > > * Nicola Mingotti <[hidden email]> [190725 23:37]: >> >> >> Hi, >> >> I was passing by, and tried : >> >> ---- >> text := Text string: 'text example ' attribute: (TextColor color: Color >> red). >> Transcript show: text;cr. > > If you browse the TranscriptStream's show: procedure you'll see > that it will send asString to the object you hand in, so in you > case the attributes of the Text get ignored as asString on Text > will just return the content's string. > > So out of the box a colorized Transcript isn't possible. > > Kind regards, > > Christian > > -- > May you be peaceful, may you live in safety, may you be free from > suffering, and may you live with ease. > _______________________________________________ > Beginners mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/beginners _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Free forum by Nabble | Edit this page |