Styling a Text Edit control

  • Board Nominations
    Nominations have now closed and the results are available here.
  • Hey Guest, MARCHintosh 2026 is upon us. Check out community projects, join GlobalTalk, and have fun!

ftech

New Tinkerer
Mar 31, 2025
19
22
3
I am updating my Logger library to incorporate a Console that is popping up at the bottom of the window from the developed app. I am using a TEHandle to achieve that and I am pretty happy with it.

However, I would like to make my console black with white text. Is there any way to achieve that with a TE control on System 6?
 

joevt

Tinkerer
Mar 5, 2023
267
104
43
I looked at https://developer.apple.com/library/archive/navigation/#section=Platforms&topic=macOS

"White Text on Black Background" says to use srcBic. Not sure how that can be used for TEHandle text.
"InvertedText" has source code that uses srcBic to draw text (but this example uses DrawString).
"Styled TextEdit Changes in System 6.0" mentions TEDrawHook which might be useful. It says the default is to call DrawText. I think you can maybe change the penMode to srcBic here and use DrawText?

I didn't check all the text related items in the archive.
 

ftech

New Tinkerer
Mar 31, 2025
19
22
3
This link is very helpful!

If I call InvertRect after updating my TEHandle, I get the expected result but it flickers when updating because the update uses black on white before inverting.

I will keep investigating the way to style the TEHandle directly so it outputs white on black straight away.