How to call NSCell's fieldEditorForView: to assign custom field editor

I have an NSTextView, which I want to use as the field editor of an NSTextField.

Since there will be other NSTextFields in the view that do not use a custom field editor, it seems I should use NSCell's method

- (NSTextView *)fieldEditorForView:(NSView *)aControlView

I can't wrap my brain around how to call this, though and have not found any examples of it in use.

NSCell's docs say that 'aControlView' is :

The view containing cells that require a custom field editor.

Which my brain is saying means 'the view this NSTextField is in', and not the NSTextField (as a subclass of NSView).

NSView *viewTheTextFieldIsIn; CustomTextView *customTextView subclass of NSTextView (the field editor) NSTextField *textField


[[textField cell] fieldEditorForView:customTextView];

makes no sense to me because its not viewForFieldEditor:...but its on NSCell.

Would someone have mercy on me, and un-snarl my thinking?


Just thought I would answer this for the archive as I think i understand it now, (amazing what sleep will do).

The specific method call's usage can be:

CustomTextView *customTextView = (CustomTextView *)[[self.textField cell] fieldEditorForView:self.textField];
[customTextView doSomeOtherStuffWithIt];

The customTextView can be used as a fieldEditor by using the window's delegate method:

-(id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client

where client can be the textField.

Then the call to fieldEditorForView on the textField will return that CustomTextView.

Category:cocoa Time:2010-12-05 Views:0

Related post

  • drupal translate module issue, assign custom fields to autotranslate 2011-01-30

    Drupal:Can I assign custom fields to autotranslate them when I create a new article? By default it creates and translates the Title and Body field, but I have several more depending on the content types. (This is set on actions) I didn't quite know h

  • Why do I have to assign all fields inside an struct's constructor? 2009-04-25

    Duplicate: Why Must I Initialize All Fields in my C# struct with a Non-Default Constructor? If in the constructor of an struct like internal struct BimonthlyPair { internal int year; internal int month; internal int count; internal BimonthlyPair(int

  • Dynamics CRM, Web Service, compile error assigning value to custom fields 2010-02-26

    Hi i'm having problems assigning a value to a custom field. i've added multiple custom fields to our Dynamics CRM 4.0 installation. i've pressed publish. I've gone to Settings -> Customization -> Download Web Description Files, and downloaded t

  • Managing users in the TFS work items "Assigned To" field 2010-08-06

    So I know there have been a couple of posts around about this topic, but I don't think they've quite got to the bottom of it! So my problem is that when I create a new work item in TFS, the users which I can assign it to include NT Authority\Local Se

  • Display custom fields in assignment block (SAP CRM 7.0) 2010-10-08

    I tried to post this on the SDN forums (SAP forums) with very very very little help...seems like anytime I post an SAP topic no one can help :(. So I decided to post on stackoverflow and can only hope there must be some SAP CRM gurus on here... Here

  • Clojure: Assigning defrecord fields from Map 2010-12-23

    Following up on How to make a record from a sequence of values, how can you write a defrecord constructor call and assign the fields from a Map, leaving un-named fields nil? (defrecord MyRecord [f1 f2 f3]) (assign-from-map MyRecord {:f1 "Huey" :f2 "D

  • Javascript Performance: Assign object fields at creation or later? 2011-01-17

    Does anyone know whether there are any performance trade-offs/advantages to assigning an object's fields at creation rather than later e.g. var exObj = new exampleObject(name, date); OR var exObj = new exampleObject(); = "blah";

  • How to assign custom cursors to entire website 2011-02-24

    I want to assign custom cursors to my entire website. I am using 4.0. I have a master page and what I want is to assign a default custom cursor to the page and have all links use another custom cursor Is this possible? --------------Solutions

  • Assigning table fields to objects within form based off of count 2011-11-09

    I am trying to pull the top three rows from a database based off of the highest count and then assign those fields to the appropriate properties class object that I then pass to the form were they are displayed. I am mainly having trouble telling the

  • Get user's email from "assigned to" field at task workflow of sharepoint 2011-12-22

    I need to get user's email from "assigned to" field at task workflow of sharepoint For example when i send email, i use this code: SPListItem wfItem = onWorkflowActivated1.WorkflowProperties.Item; SPFieldUser assignedTo = (SPFieldUser)wfItem.Fields["

  • TF285017: The Assigned To field cannot be blank 2012-02-02

    I'm working with TFS 2010 and Project 2010 Feature Integration pack and the Scrum for Team System v3 process template. Within the Project Server tab, I'm trying to set the default value for "Submit to Project Server" and "Enterprise Project" (which w

  • Bugzilla Extension: Modifying "Assigned To" field using set_assigned_to in bug_end_update 2012-03-09

    I am trying to modify the Assigned To field on a bug (to Reporter) when the status is set to RESOLVED. My current code looks like this: sub bug_end_of_update { my ($self, $args) = @_; my $bug = $args->{ 'bug' }; my $changes = $args->{ 'changes'

  • Assign Key Field Value Only If Corresponding Lookup Result value Exist 2012-04-03

    I have ten master tables and one Transaction table. In my transaction table (it is a memory table just like ClientDataSet) there are ten lookup fields pointing to my ten master tables. Now i am trying to dynamically assigning key field values to all

  • I have created Custom fields in Outlook 2003. I want to assign a default value to all of them. 2012-04-20

    I have created custom fields in Outlook Contacts. I have written this VBA code to assign a default value to the "WomComm" field defined as a Yes/No field, and to assign a value to the "SD" field defined as text. Asigning "This is a test" to the FTPSi

  • What does assignment owner field designate? 2013-02-08

    I have a master project sheet and each project has a different stakeholder assigned to it. It would seem that assignment owner field would be appropriate for this task assignment. Again, this is obviously different than the resource fields. However,

  • Project Online - Cannot add custom fields in a View when a formula is assigned 2013-06-18

    Hello, I have a curious issue.... I have created a few custom fields (Project level) in Project Online, but of those I created that have a formula assigned to them, these fields do not appear in the field list when I am trying to create or modify a P

  • How to change the 'Assigned To' field in Project Server Workflow Tasks? 2013-08-21

    I am working on Demand Management part in MS Project Server 2010. Whenever a workflow for new project is started, it is always routed to the Admin account for approval. I need to change the approving authority so that the project is approved by the l

  • Managing assignment information: how to create custom fields 2013-12-31

    Hello, I'm trying to find a way to create my own custom field (of the type 'outline code ' really) for assignments. The goal is to be able to share a common (but custom) information between the 'task usage view ' and the 'ressource usage view '. What

  • How to assign Custom class as datasource in crystal report 2009-08-07

    I created crystal report and through Data-->object i generated the DataSource and i added the fields from generated Datasource. My problem is, how to assign the values to the datasource. Is anything like grid.DataSource = MyCustomClass is availabl

Copyright (C), All Rights Reserved.

processed in 1.026 (s). 13 q(s)