简体   繁体   中英

NSTableView early detection of edit session

I've a NSTableView (view-based) whose delegate (my windowcontroller, in this case) needs to be notified as early as possibile of Text editing session starts. I've tried with the Text Delegate method

- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor;

but this not working in my case. The event gets triggered (and the delegate invoked) if and only if i hit some key in the keyboard. If, by any chance, i click outside the control without having typed anything, the edit session silently stops without notifying anybody. Any help is appreciated.

@theAmateurProgrammer Thank you for your suggestion. Well, what you suggest would do only in case of mouse events. Instead, i need to detect the start edit session event always , also in case of, for example, programmatically triggered editing. However i've found the solution. I subclass the table view and then i override the validateProposedFirstResponder method. The responder, actually, is the TextField which is about to start editing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM