newbie: how to change the background color of part of texts?

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}

for example.

Any suggestion is welcome!

Common on guys - is it really impossible? Please teach me, thanks…

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.

Jon

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.

Thx a bunch!

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.

Jon

On a similar line of thought…

IIs it possible to set a background color for specified cells, rows, or columns inside a table without coloring the entire table?


thanks for any help. (i’m about 1 week into AS Studio, and i feel like i’m deep in the jungle with a dull machete…)

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.