Pregunta

I have a view based NSTableView in which the cells contain a number of controls including text fields and edit fields. When a user tries to click on a control within a cell in order to, for example, start editing a text field, the click's main objective is ignored and the cell gets selected. Another click is then needed to perform the action originally intended, and even this click is subject to a delay before it's taken into account.

How can I avoid this problem and have the row selected and the mouse event forwarded to the control in one go?

¿Fue útil?

Solución

I solved this issue by subclassing NSTableView:

@implementation QuickResponseTableView

- (BOOL)validateProposedFirstResponder:(NSResponder *)responder forEvent:(NSEvent *)event
{
    // This allows the user to click on controls within a cell withough first having to select the cell row
    return YES;
}

@end

Otros consejos

Had the same problem. After much struggle, it magically worked when I selected None as against the default Regular (other option is Source List) for the Highlight option in IB! The accepted answer appears to be more specific but a little hacky compared to this.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top