Thanks to Shane and Mark I do see a some light on the horizon with my little test app.
As I explained before in other questions the app somehow should process video subtitle files.
The nature of these cue text things is that the text is displayed against a black (or grey) background. Text color default is white, but yellow, cyan sometimes purple are used as well depending on the type of cues.
So the background of the table view is black, some text cells might have a dark color other than black.
As long as no row is selected everything is fine. Once a row is selected it will get blue ( or the settings of the system). That’s something people might be able to live with.
But when the table view is “out of focus” the row turns into “light grey” and everything is not readable anymore.
Same with text selection.
Is there a way to change the “high-lighting” of a row into something like a “focus ring”?
You probably need to do something like set the selectionHighlightStyle property to NSTableViewSelectionHighlightStyleNone, and then subclass table view or row view and implement your own highlighting.
Unfortunately I have no idea (yet) how to do that.
But I found a poor man’s solution. I set the “Highlight” to “Source List” and put some vertical offset to the text cells.
One of the suggestions I found most useful when starting with Xcode was to always look for examples of what I wanted. If I couldn’t find them, there’s a fair chance I was doing something either impossible or discouraged (“fighting the frameworks”). It’s not always the case, but it’s worth considering. How many all-dark-background tables do you see?
That said, you may do better to make a single-column view-based table. That way you put all info as text fields on a view, and it gives you a lot more flexibility in terms of layout.
In my business I haven’t seen many ‘not all-dark-background’ tables.
Unfortunately a single column table would not make any sense at all in this case. Current column set is the minimum. The values displayed makes it hard to understand though.
In case you missed what I was saying, it would still contain the same info. Think of each cell being like a small window that can contain many fields, arranged as you like.
Most tables are view-based these days. From simple things like, say, the search column in Xcode, to the columns in FaceTime, the second panel in Mail, the sidebar in Messages…
Depending on your requirements, it’s really not that hard. How are you populating your table – bindings? And how many of your current columns are editable?
I use bindings to populate the table view.
Finally none of the columns need to be edited directly.
One problem I do see though is to edit the values and send back to the array.
The upper black region displays the “real” text. The text in the table might be wrapped. Means you have a long text line and it looks good in the table cell cause it is wrapped but would be too long in real life usage. This is a “text view” to have a coloured insertion point.
The values per row are times for the text: in, out, duration and distance in frames to the previous text cue. The text itself followed by the count of characters of the longest line of the text and the reading speed in “characters per second”.
So changing the text will/can change both the “max characters” and/or the “CPS” value.
I haven’t found a way yet to update values automatically or get a warning when the row changes.
It worked fine in ASS to compare row changes before switching to the next row.
I could use a text field, but only get a black insertion point.
Changing times will affect “CPS” as well but can handled easily I think.
If you expand the table hierarchy for a single-column table, it looks like this:
The highlighted item is a view (NSTableCellView) which you can actually drag out to make as big as you want, and you can add text fields, image views, etc to it. By default is has just one text field, confusingly labeled Table View Cell in the above.
Once you have added the views you want, you set up their bindings. So the binding for standard text field might look like this:
It always starts with objectValue., and you add the key for the particular item you want inserted.
(You can ignore the Text Cell item — that’s for cell-based tables only.)