Q: how to change the background color of part of text, inside a text view? This is for my first AppleScript Studio app…
Ok to be more specific, here is the code:
set textRef to a reference to (text of text view “editor” of scroll view “editor” of window of theObject)
set color of word 1 of textRef to {65535, 65535, 65535}
but I can’t do
set background color of word 1 of textRef to {0, 0, 65535}
Yes, it is impossible. You can set the background color for the entire text view but not for individual segments of text. If you look at the dictionary for Xcode or Project Builder,
you’ll see that the only properties available for text are size, font, & color–the text color, not the background.
Oh no… do you think using the webkit and display texts as HTML is a good idea? I tried to put a webview in Interface Builder, but when building and running it, the class always fails to initialize.
You could do that but then to control the properties of the text (i.e., background color), you’ll either need to use static HTML, CSS, or JavaScript, I think, and this will be very difficult to implement if you want to create a text editor that the user can completely control (it would be much easier for static text). I haven’t tried web views yet, but from what I’ve read, they aren’t explicitly scriptable via AS.
i’d also like to know how to change the background color of a column of a table. even in IB and not in xcode. dropping a color onto the column looks like it should work but it doesn’t. there is some binding setting for text color but it looks complicated.