• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Questions about NSPopupButtonCell and NSBrowser
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Questions about NSPopupButtonCell and NSBrowser


  • Subject: Questions about NSPopupButtonCell and NSBrowser
  • From: "Frank D. Engel, Jr." <email@hidden>
  • Date: Wed, 03 Jun 2015 17:29:55 -0400

I have two questions I'm hoping I can get some advice on...


First the complicated one:


I have an NSTableView (cell-based) in which I am trying to rig two columns with NSPopupButtonCell - the selection in the first one determines the possible values of the second.
This is part of a document-based core data setup; the data model has
three entities that are relevant to this activity; for my purposes here
I will call the first two A and B.  There is a one-to-many relationship
from A to B, such that an A has - let's call them "kids", and the
reverse would be the "parent" of a B.  Every B is tied to an A; an A
will usually have one or more B's.
The individual rows in the NSTableView are members of another entity,
which I herein call E, which has a many-to-one relationship to a B (any
given E has exactly one B tied to it, call it the "b" of E; but several
E's can be tied to the same B).
I created a custom NSManagedObject subclass which implements a method,
call it "a", which returns "b.parent" - the A of the B that the E is
connected to.

Attempt at a picture:

    A -> B  <- E
    | -> B
    | -> B  <-- E
             |- E



The first NSPopupButtonCell should have a list of all of the A's and let me pick one - that much I have working using bindings:
    Content: aController.arrangedObjects
    Content Values: aController.arrangedObjects.name
    Selected Object: eController.arrangedObjects.a


Now I'm trying to figure out how to set up the second NSPopupButtonCell to list all of the B's whose parent is A (so, a.kids) with the "b" of E being the selected one.
I can't very well use another NSArrayController to do this (at least not
via IB?) since the list may be different for each row of the table.
I'm a bit confused on how to rig this one and I'm not finding any clear
documentation to help with this.

Does anyone have any suggestions on how to make this work? I don't want to just list all of the B's since there could be thousands of them and it would be WAY too much to navigate through without narrowing it down first (thus the first popup list...)


Now what I am hoping is the simpler one:

I have a custom subclass of NSTextFieldCell which I am using to show an icon in an NSBrowser. The icon image is being generated dynamically by a method in my subclass and I want it to change more or less in "real time" as a bound value changes. I have that almost working, but the one problem is that it doesn't refresh when I need it to.
Is there some way I can "force" a browser cell to redraw its image,
short of redrawing the entire browser or window?  The text isn't
changing, just the icon, but I'd settle for redrawing the cell...
I've tried a number of things to get this working and it seems I keep
coming up short.


Thank you!

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Questions about NSPopupButtonCell and NSBrowser
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: Understanding the "declaration of instance variables in the interface is deprecated" warning.
  • Next by Date: Re: Questions about NSPopupButtonCell and NSBrowser
  • Previous by thread: Re: How to enable local storage in WebView using Swift
  • Next by thread: Re: Questions about NSPopupButtonCell and NSBrowser
  • Index(es):
    • Date
    • Thread