timthedevguy / BGHUDAppKit

* BGHUDAPPKIT is no longer under development by me, I hope that the community will keep it alive and going as I no longer have time to dedicate to the project** The missing HUD controls. Please scroll down to read the readme file for an important notice concerning the future of BGHUDAppKit. Note that there are multiple versions available, 10.5+, 10.6.7, and now 10.7. As soon as I learn how I'll make these all one code base if possible.
http://www.binarymethod.com/
312 stars 57 forks source link

Table view text is not visible when editing cells #37

Closed tomaz closed 13 years ago

tomaz commented 13 years ago

Text field cell text has the same color as the background of the field editor. When text is selected it's visible due to highlight having different color, but unselected text is not visible at all...

After playing with it for a while, decided the easiest fix would be to change the cell class of the table view to BGHUDTextFieldCell and setup field editor's background color besides text color. Here's the code:

- (NSText *)setUpFieldEditorAttributes:(NSText *)textObj {
    NSText *newText = [super setUpFieldEditorAttributes: textObj];
    NSColor *textColor = [[[BGThemeManager keyedManager] themeForKey: self.themeKey] textColor];
    NSColor *backColor = [[[BGThemeManager keyedManager] themeForKey: self.themeKey] cellEditingFillColor];
    [(NSTextView *)newText setInsertionPointColor:textColor];
    [(NSTextView *)newText setBackgroundColor:backColor];
    return newText;
}

As default BGHUDTableView uses standard NSTableViewCell, each column's cell class needs to be changed to BGHUDTextFieldCell in order for this to work...

timthedevguy commented 13 years ago

I will be checking out this issue tomorrow. I will keep you posted.

timthedevguy commented 13 years ago

This appears to be working fine for me, or maybe I'm missunderstanding something.

TableView Image

tomaz commented 13 years ago

Yep, I noticed, I'm using BGHUDTextFieldCell as column data cell, and it's causing me problems. With default NSTextFieldCell, it's working...

timthedevguy commented 13 years ago

You are right though, logicly the Cell class should be BGHUDTextFieldCell, I'm going to change the default operation so that this is the case. It will take a little time but I'll be working on it in my development branch.