Raise baseline in NSTextView field editor

51 views Asked by At

I want to manipulate the baseline when typing text in an NSTokenField to match the displayed tokens. To do so, I'm following the guide "Working With the Field Editor" in the documentation. There it is recommended to override the method - (NSText *)setUpFieldEditorAttributes:(NSText *)textObj; of the associated NSTextFieldCell to adjust the field editors properties before editing. Here's what I do there:

- (NSText *)setUpFieldEditorAttributes:(NSText *)textObj {
    textObj = [super setUpFieldEditorAttributes:textObj];
    if([textObj isKindOfClass:[NSTextView class]]) {
        NSTextView *fieldEditor = (NSTextView *)textObj;
        [fieldEditor raiseBaseline:self];
        [fieldEditor raiseBaseline:self];
        [fieldEditor raiseBaseline:self];
        NSLog(@"Raised editor baseline");
    }
    return textObj;
}

As I can confirm with the help of the log, the method get's called. However, the baseline doesn't change at all while editing. Also calling other methods like [fieldEditor loosenKerning:self] that should produce a visible result don't seem to be having any effect. What am I doing wrong here or better - how can I achieve what I want to?

0

There are 0 answers