开发者

How to hide focus ring for NSTextFieldCell?

I'm trying to get this blue border (which is around a NSTextFieldCell when you can edit the value) out of the way. Is there a way manage this somehow? At the same time the user should still be able to change the text just by double-clicking, thou开发者_高级运维gh.

For the table itself I got rid of it by setting this Focus ring option to None. But I can't find it for any Text Field unfortunately...


Don't forget to check superclasses when looking in the docs for something. In this case, since NSTextFieldCell inherits from NSCell, you want to use -[NSCell setFocusRingType:].

The easiest way to get the cell before it becomes focused is probably the NSTableViewDelegate method tableView:shouldEditTableColumn:row:

- (BOOL)tableView:(NSTableView *)tableView 
shouldEditTableColumn:(NSTableColumn *)tableColumn 
                  row:(NSInteger)row 
{        
    NSTextFieldCell * cell = [tableColumn dataCellForRow:row];
    [cell setFocusRingType:NSFocusRingTypeNone];
    return YES;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜