Re: NSColorPanel changeColor not called

2010-02-25 Thread David Blanton
Yes,  I had done that before also to no avail.  But thinking I might  
have been tired and erred I have done it again.
Still does not work.  I am including the code and a link to a debug  
picture that shows all is set correctly (as far as I can tell).

Would someone be willing to run this code and post results?
Might Apple comment or weigh in on this?

- db

The code: (in this example I moved cp to be an ivar thinking there was  
some scope issue)



NSColorPanel* cp;


- (IBAction)color:(id)sender {


cp = [NSColorPanel sharedColorPanel];
[cp setDelegate:self];
[cp setTarget:self];
[cp setAction:@selector(changeColor:)];
[cp setContinuous:YES];
[NSApp runModalForWindow:cp];
[cp orderOut:cp];
}

- (void)changeColor:(id)sender {

NSLog(@changeColor);
}

- (void)windowWillClose:(NSNotification *)notification {

[NSApp stopModalWithCode:0];
}


A link to an annotated picture of the variables

http://crusaderrabbit.net/NSColorPanel.jpg






On Feb 25, 2010, at 12:30 AM, Graham Cox wrote:

Ah, your reply prompted me to review the documentation, which I  
believe is in error.


It's not the delegate that gets sent this message, it's the panel's  
target. use -setTarget: instead. -changeColor: is also sent to the  
responder chain regardless.


The documentation lists -changeColor: under delegate methods but  
the panel only inherits the delegate methods of NSWindow, etc.


--Graham





On 25/02/2010, at 6:21 PM, David Blanton wrote:


Well, no.

I have run it

modal from a modal panel
non-modal from a modal panel
non-modal from a non-modal panel

changeColor is never called.

I am stumped and going to pour a glass of wine and play a game of  
chess !


- db

On Feb 24, 2010, at 11:53 PM, Graham Cox wrote:



On 25/02/2010, at 5:44 PM, David Blanton wrote:


Am I missing something obvious?



Generally apps don't run the color panel modally. I believe there  
is a way to do it, I've seen it in some apps with an added OK/ 
Cancel button, though it seems rare and weird. It may be that  
running it this way works differently, or maybe what you're doing  
is just unsupported.








___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSColorPanel changeColor not called [work around]

2010-02-25 Thread David Blanton
I replaced calling NSColorPanel from a button click by using an  
NSColorWell and setting an action on it.


Looks more Mac like as you see the current color before getting the  
picker


Still would like to know why changeColor isn't called, eh Apple?

-db



On Feb 25, 2010, at 9:30 AM, David Blanton wrote:

Yes,  I had done that before also to no avail.  But thinking I might  
have been tired and erred I have done it again.
Still does not work.  I am including the code and a link to a debug  
picture that shows all is set correctly (as far as I can tell).

Would someone be willing to run this code and post results?
Might Apple comment or weigh in on this?

- db

The code: (in this example I moved cp to be an ivar thinking there  
was some scope issue)



NSColorPanel* cp;


- (IBAction)color:(id)sender {


cp = [NSColorPanel sharedColorPanel];
[cp setDelegate:self];
[cp setTarget:self];
[cp setAction:@selector(changeColor:)];
[cp setContinuous:YES];
[NSApp runModalForWindow:cp];
[cp orderOut:cp];
}

- (void)changeColor:(id)sender {

NSLog(@changeColor);
}

- (void)windowWillClose:(NSNotification *)notification {

[NSApp stopModalWithCode:0];
}


A link to an annotated picture of the variables

http://crusaderrabbit.net/NSColorPanel.jpg






On Feb 25, 2010, at 12:30 AM, Graham Cox wrote:

Ah, your reply prompted me to review the documentation, which I  
believe is in error.


It's not the delegate that gets sent this message, it's the panel's  
target. use -setTarget: instead. -changeColor: is also sent to the  
responder chain regardless.


The documentation lists -changeColor: under delegate methods but  
the panel only inherits the delegate methods of NSWindow, etc.


--Graham





On 25/02/2010, at 6:21 PM, David Blanton wrote:


Well, no.

I have run it

modal from a modal panel
non-modal from a modal panel
non-modal from a non-modal panel

changeColor is never called.

I am stumped and going to pour a glass of wine and play a game of  
chess !


- db

On Feb 24, 2010, at 11:53 PM, Graham Cox wrote:



On 25/02/2010, at 5:44 PM, David Blanton wrote:


Am I missing something obvious?



Generally apps don't run the color panel modally. I believe there  
is a way to do it, I've seen it in some apps with an added OK/ 
Cancel button, though it seems rare and weird. It may be that  
running it this way works differently, or maybe what you're doing  
is just unsupported.








___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/airedale%40tularosa.net

This email sent to aired...@tularosa.net





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSColorPanel changeColor not called

2010-02-24 Thread David Blanton

changeColor is listed as a delegate method for NSColorPanel

Here is my code

- (IBAction)color:(id)sender {

NSColorPanel* cp;
cp = [NSColorPanel sharedColorPanel];
[cp setDelegate:self];
[cp setContinuous:YES];
NSLog(@%@,[cp delegate]);
[NSApp runModalForWindow:cp];
[cp orderOut:cp];
}

- (void)changeColor:(id)sender {

NSLog(@changeColor);
}

and console output showing the delegate

2010-02-24 23:40:33.810 Customize It[7097:813] MDlgGrid: 0x1300de80

but changeColor is never called


Am I missing something obvious?

-db
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSColorPanel changeColor not called

2010-02-24 Thread Graham Cox

On 25/02/2010, at 5:44 PM, David Blanton wrote:

 Am I missing something obvious?


Generally apps don't run the color panel modally. I believe there is a way to 
do it, I've seen it in some apps with an added OK/Cancel button, though it 
seems rare and weird. It may be that running it this way works differently, or 
maybe what you're doing is just unsupported.

Either way, running the panel 'normally' , i.e. as a modeless floater, should 
work.

--Graham

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSColorPanel changeColor not called

2010-02-24 Thread David Blanton

Well, no.

I have run it

modal from a modal panel
non-modal from a modal panel
non-modal from a non-modal panel

changeColor is never called.

I am stumped and going to pour a glass of wine and play a game of  
chess !


- db

On Feb 24, 2010, at 11:53 PM, Graham Cox wrote:



On 25/02/2010, at 5:44 PM, David Blanton wrote:


Am I missing something obvious?



Generally apps don't run the color panel modally. I believe there is  
a way to do it, I've seen it in some apps with an added OK/Cancel  
button, though it seems rare and weird. It may be that running it  
this way works differently, or maybe what you're doing is just  
unsupported.


Either way, running the panel 'normally' , i.e. as a modeless  
floater, should work.


--Graham






___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSColorPanel changeColor not called

2010-02-24 Thread Graham Cox
Ah, your reply prompted me to review the documentation, which I believe is in 
error.

It's not the delegate that gets sent this message, it's the panel's target. use 
-setTarget: instead. -changeColor: is also sent to the responder chain 
regardless.

The documentation lists -changeColor: under delegate methods but the panel 
only inherits the delegate methods of NSWindow, etc.

--Graham





On 25/02/2010, at 6:21 PM, David Blanton wrote:

 Well, no.
 
 I have run it
 
   modal from a modal panel
   non-modal from a modal panel
   non-modal from a non-modal panel
 
 changeColor is never called.
 
 I am stumped and going to pour a glass of wine and play a game of chess !
 
 - db
 
 On Feb 24, 2010, at 11:53 PM, Graham Cox wrote:
 
 
 On 25/02/2010, at 5:44 PM, David Blanton wrote:
 
 Am I missing something obvious?
 
 
 Generally apps don't run the color panel modally. I believe there is a way 
 to do it, I've seen it in some apps with an added OK/Cancel button, though 
 it seems rare and weird. It may be that running it this way works 
 differently, or maybe what you're doing is just unsupported.
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com