• 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
Re: Changing color in NSColorPanel without message
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing color in NSColorPanel without message


  • Subject: Re: Changing color in NSColorPanel without message
  • From: Andy Lee <email@hidden>
  • Date: Thu, 17 Jan 2013 16:45:46 -0500

On Jan 17, 2013, at 2:53 PM, Ken Thomases <email@hidden> wrote:

> On Jan 16, 2013, at 2:47 PM, Melvin Walker wrote:
>
>> Is it possible to programmatically change color (using -setColor:) in NSColorPanel without it sending a changeColor: message to the first responder?
>>
>> We'd like it to just reflect a color change without telling the responder chain about it.
>
> I believe that NSColorPanel dispatches the -changeColor: action method using -[NSApplication sendAction:to:from:].  Therefore, you should be able to use a custom application object (subclass of NSApplication) with an override of that method which short-circuits for that selector (perhaps only under certain circumstances).

Ooh! I tried overriding targetForAction:to:from: and targetForAction:, assuming they were getting called. But I didn't think to try sendAction:to:from:. Will give that a shot.

Note that even if this works, it doesn't suppress the NSColorPanelColorDidChangeNotification, so there may still be unwanted side effects of setting the color panel's color.

--Andy (for some reason obsessed with Melvin's problem)


_______________________________________________

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: Changing color in NSColorPanel without message
      • From: Andy Lee <email@hidden>
References: 
 >Changing color in NSColorPanel without message (From: Melvin Walker <email@hidden>)
 >Re: Changing color in NSColorPanel without message (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: CALayer renderInContext changes zPosition of some child layers
  • Next by Date: Using NSSavePanel to export to UTTypeFolder without a file extension.
  • Previous by thread: Re: Changing color in NSColorPanel without message
  • Next by thread: Re: Changing color in NSColorPanel without message
  • Index(es):
    • Date
    • Thread