tag:blogger.com,1999:blog-7952810330436823110.post6156323063855237722..comments2024-03-20T10:09:26.121+01:00Comments on The Grey Blog: NSControlTextEditingDelegate Methods Are Not Called on a the Delegate of a View-Based NSTableViewEnrico M. Crisostomohttp://www.blogger.com/profile/02688166348157974808noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-7952810330436823110.post-66367087371100260252018-01-19T01:17:49.085+01:002018-01-19T01:17:49.085+01:00Thank you very much. Had to search long and hard t...Thank you very much. Had to search long and hard to find this post. Definitely improved my understanding of Table Views.<br /><br />So I'm indeed using a view-based NSTableView. I did assign delegate for both my TableView and my Table View Cell to be the ViewController. I did it using NIB editor. However I'm not getting the expected result.<br /><br />While my tableView methods are being called in my NSTableViewDelegate ViewController Extension, my control methods are not being called. Appreciate if you can suggest what I might be doing wrong.<br /><br />extension ViewController: NSTableViewDelegate {<br /> func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {<br /> // DOES get called and allows me to populate my table<br /> cell = tableView.makeView(withIdentifier: (tableColumn?.identifier)!, owner: self) as! NSTableCellView<br /> // ... code to populate omitted<br /> return cell<br /> }<br /> <br /> func control(_ control: NSControl, textShouldBeginEditing fieldEditor: NSText) -> Bool {<br /> // Does not get called when I start editing <br /> return true<br /> }<br /> <br /> func control(_ control: NSControl, textShouldEndEditing fieldEditor: NSText) -> Bool {<br /> // Does not get called when I end editing<br /> return true<br /> }<br /> <br />}<br /><br />Do I need to include the control methods in separate extension that implements the NSControlTextEditingDelegate protocol? Since NSTableViewDelegate implements NSControlTextEditingDelegate I thought I shouldn't have too<br /><br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7952810330436823110.post-42416872444475442582016-01-28T22:46:25.499+01:002016-01-28T22:46:25.499+01:00I'm glad it helped!I'm glad it helped!Enrico M. Crisostomohttps://www.blogger.com/profile/02688166348157974808noreply@blogger.comtag:blogger.com,1999:blog-7952810330436823110.post-62637580429486580832016-01-28T21:44:59.637+01:002016-01-28T21:44:59.637+01:00I spent all afternoon reading the documentation an...I spent all afternoon reading the documentation and trying to get this to work. I'm a newbie but still, the Apple documentation is either too dated or just unclear. I read your post and, in five minutes, everything worked. You rock!!!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7952810330436823110.post-68618085467740984152015-12-31T16:53:53.464+01:002015-12-31T16:53:53.464+01:00Ditto! Thanks for working this out and publishing ...Ditto! Thanks for working this out and publishing this.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7952810330436823110.post-33532485895706970372015-01-17T19:39:03.514+01:002015-01-17T19:39:03.514+01:00Thanks! The same problem was beginning to annoy m...Thanks! The same problem was beginning to annoy me!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7952810330436823110.post-24837452311905368332014-12-30T19:17:03.374+01:002014-12-30T19:17:03.374+01:00Thanks! Had a similar problem with delegate metho...Thanks! Had a similar problem with delegate methods "controlTextDidBeginEditing" and "controlTextDidEndEditing". I also spent hours researching the issue until I found your blog. Thanks, again.Anonymousnoreply@blogger.com