Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Programatically pop-up a NSPopUpButtonCell in a NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Programatically pop-up a NSPopUpButtonCell in a NSTableView

I have a table view with a mix of text columns and pop-up columns. I'm using bindings and core data.

To provide better keyboard navigation I would like that when pressing tab the focus would move through both the text cells and the pop-up cells. By default, the pop-up cells are skipped when tabbing and only the text fields are traversed.

The closest to a solution I have come is the following. In a sub- class to NSTableView I intercept the "insertTab:" message and do the following:

// row and col are the position of the cell to pop-up
[self endEditing];
NSRect frame = [self frameOfCellAtColumn:col row:row];
NSPopupButtonCell *cell = [[[self tableColumns] objectAtIndex:col] dataCell];
[cell performClickWithFrame:frame inView:self];

This is working to the extent that I manage to intercept the tab when leaving the previous text cell, end the editing of that cell and pop- up a list of items. The problem is that the list only contains the current item, not the whole list which normally are fetched from the core data store using bindings.

I tried to add an item manually using [cell addItemWithTile:@"Test"] and the new item is then shown, but it is not selectable!? Besides, I would much prefer I could get this to integrate properly with bindings and core data.

So my question is, what is the best way to programmatically pop-up a NSPopButtonCell in a NSTableView while still getting it properly populated using bindings to core data?

Best regards,
Jacob Wallström

On Feb 14, 2007, at 11:07 AM, email@hidden wrote:

Welcome to the email@hidden mailing list! Please stay
on-topic ====================

In 2005, over 26,000 messages were sent to the list.  In order to keep
the list useful and to maximise your chances of getting an answer to
your question, please stay on topic and adhere to the guidelines given

    "How To Ask Questions The Smart Way"

If someone posts a message that is off-topic, please do not reply to
the list.  You should contact the sender directly or alert a
moderator.  If a moderator flags a thread as closed (typically with
"EOT" in the subject line), do not continue to post to that

If you post a message that is blatantly off-topic, you are liable to
be suspended.

**** Other Apple mailing lists that may be relevant are listed at: <> in particular see: Xcode-users: <>

The Omni Group hosts a general Mac OS X developer list:

There is a Yahoo Group for discussion of business-related issues at:

Do not abuse your NDA =========================

Do not discuss Mac OS X Leopard development related issues on this
list.  Mac OS X Leopard seeds are made available to you under NDA and
you are not allowed to discuss them on any public mailing list.

List etiquette ==============

When you post a message, bear in mind that you are asking several
thousand people to listen to what you're saying.  In addition to the
guidelines given in "How To Ask Questions The Smart Way",
please ensure that you abide by the list rules:

        In particular: please "Edit included messages in replies
        minimize the amount of text."  There is no need, for
        to include the list footer in your reply.

**** Before posting a question, please check the list archives (see "Online resources" below) and try searching Google. Many questions have been asked before and have already been answered.

**** When you ask a question, whenever possible please:

	1. Describe what your high-level goal is
	2. Include any relevant code
	3. If appropriate, include URLs to screenshots

    For more details, see:


If you post a message to the list and do not get a reply, you should not simply repost the message. There may be reasons why no-one has answered, see the references above. If you want to send again, add more information or background, or explain what further steps you have taken in the interim to solve your problem.

Note that you should never post to the list any message that was sent to you privately unless you have the original author's permission.

Cocoa-related resources =======================

Cocoa-related resources that may answer your question without the need
to wait for a reply from the list:

Apple's documentation ---------------------

The Cocoa Getting Started page.
If you haven't read any Cocoa documentation and want to learn
the technology, you should begin with this.
< GS_Cocoa/>

Main documentation links:

Apple produces several kinds of documentation. For an overview of how to use the documentation, see:

< usingreflib.html>

and <>

* Finding documentation

If you are not sure where to find documentation relevant to your
problem, a useful strategy is to go to the API reference for a
relevant class and look at its companion document.  You can also
search the online documentation suite using the search field at the
top right of the page (see, for example,
<>). It
is often a good idea to check the "Restrict to Cocoa" box.
If you need more precise search, you can use the Advanced Search panel
at <>.

Remember you can also view and search the documentation in Xcode --
see the "Help" menu.  You can see all the methods associated
with a class (and links to relevant documentation) using Xcode's Class
Browser (see the Project > Class Browser menu item).  In Xcode, you
can Option-double-click on a symbol to look it up in the
documentation, and you can Command-double-click on a symbol to go to
the header file in which it is declared.

* Keeping documentation up-to-date

You can keep your local documentation up-to-date by using the
Documentation update preference in Xcode.  Apple's developer
documentation is updated en bloc about once a month.  An update
package is made available at about the same time that updates are
published on the web site.

Code examples -------------

Apple provides code samples in two places, on-disk (installed with the
developer tools) and online:

    Developer examples


Online resources ----------------

    "UNOFFICIAL Cocoa-dev Frequently Asked Questions"
        Especially useful for pointers to documents relating to memory
        and book recommendations

List archives <>

Combined Apple and Omni Cocoa developer list archives <>

Cocoa-related sites <> <> <>

Cocoa Bindings
< CocoaBindings/>

< CocoaBindingsRef/>

< controllers.html>

< cocoa.html>

Google <> (It is sometimes the case that using the subject line of a post as a search term in Google will yield an answer. If this is the case, you have probably not invested sufficient effort into finding an answer to your problem, and you are likely to receive a reprimand.)

Memory management -----------------

Developers are strongly discouraged from attempting to reformulate
Cocoa's memory management rules in posts to the list. Almost
invariably, someone makes a subtle or not-so-subtle mistake which then
results in confusion and additional messages to resolve the issue.
Simply post links to the relevant documentation, such as:
< MemoryMgmt/Tasks/MemoryManagementRules.html>

Links to other reviewed articles that discuss memory management are given in <>

To post to this list, send your email to:


General information about the mailing list is at:

If you ever want to unsubscribe or change your options (eg, switch to
or from digest mode, change your password, etc.), visit your
subscription page at:

You can also make such adjustments via email by sending a message to:


with the word `help' in the subject or body (don't include the
quotes), and you will get back a message with instructions.

You must know your password to change your options (including changing
the password, itself) or to unsubscribe.  It is:


Normally, Mailman will remind you of your mailing list
passwords once every month, although you can disable this if you
prefer.  This reminder will also include instructions on how to
unsubscribe or change your account options.  There is also a button on
your options page that will email your current password to you.


Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

Visit the Apple Store online or at retail locations.

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.