• 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
Fwd: Filtering NSPopUpButtonCell when clicking on it
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: Filtering NSPopUpButtonCell when clicking on it


  • Subject: Fwd: Filtering NSPopUpButtonCell when clicking on it
  • From: Kubernan <email@hidden>
  • Date: Thu, 15 Jan 2009 22:09:56 +0100



Début du message réexpédié :

De : Keary Suska <email@hidden>
Date : 15 janvier 2009 17:25:29 HNEC
À : Kubernan <email@hidden>
Cc : email@hidden
Objet : Rép : Filtering NSPopUpButtonCell when clicking on it


On Jan 15, 2009, at 4:04 AM, Kubernan wrote:

In my outline view i have a NSPopUpButtonCell for which the table column is bound
to a NSArrayController that contains coredata entities.


The goal is to restrict the content of items in the pop up cell depending on
other attributes of the row.


So i decided to call the setFilterPredicate: of the array controller as soon as the user
click on the pop up cell and of course before the content of this pop up is displayed.


For that it seems i could use (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame ofView:(NSView *)controlView untilMouseUp: (BOOL)untilMouseUp in a subclass of NSPopUpButtonCell. But this method appears to me
little bit complex for my simple need and the documentation says "This method is generally not overridden because the default implementation invokes other NSCell methods that can be overridden to handle specific events in a dragging session."


My question is what methods and strategy should i use for setting the predicate of my array controller before
the content of the pop up cell is displayed ?

Have you tried setting the filterPredicate at the point the "row" object is set/selected? I assume that would happen before the popup is opened. And probably a saner approach.


HTH,


Thanks for your help, it works fine with outline view delegate method : - (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item. It's not the perfect solution because each time the user click on a row (and not only a cell - my pop up cell - on this row) i have to build a new predicate and test if there is a difference with the current filter predicate in the array controller. But it works.


Regards,
Kub._______________________________________________

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:
    • ObjC in time-critical parts of the code
      • From: Jens Bauer <email@hidden>
References: 
 >Re: Filtering NSPopUpButtonCell when clicking on it (From: Keary Suska <email@hidden>)

  • Prev by Date: Re: NSOutlineView, tracking in a custom NSTextFieldCell, & Shift&Cmd Keys
  • Next by Date: Re: NSOutlineView, tracking in a custom NSTextFieldCell, & Shift&Cmd Keys
  • Previous by thread: Re: Filtering NSPopUpButtonCell when clicking on it
  • Next by thread: ObjC in time-critical parts of the code
  • Index(es):
    • Date
    • Thread