Re: Uninitialized rectangle??

2010-03-04 Thread fabian
On Thu, Mar 4, 2010 at 12:38 AM, Jens Alfke j...@mooseyard.com wrote:


 On Mar 3, 2010, at 3:00 PM, fabian wrote:

  Thanks for your replies. I understand that the -frame message is returning
 garbage. What I don't understand is why statusBar, statusItem or the
 statusItem's view is nil during (but not after) the unarchiving of the
 nib,
 or (on 10.5.8) even shortly after NSApp is fully loaded. Or is it?


 By the time -applicationDidFinishLaunching is called, everything should be
 up and running. During -awakeFromNib (of the main nib), things are iffier.
 You know that your outlets have been initialized, but you don't know that
 every other object's -awakeFromNib method has run yet.


Right. But why should it matter? The system status bar is not in the nib.
Just curious about what is going on behind the scenes...


 It's definitely related to the app/nib not being up and ready to go.
 I'm displaying a dialog on first run in awakeFromNib. When the dialog



Putting up a dialog from within an -awakeFromNib method is a really, really,
 bad idea. (If it's a modal dialog, add three or four more reallys.) You
 should either do the check later, or a delayed-perform so the dialog is only
 displayed after the app is initialized.

 —Jens


It's a modal, indeed. I can see why it's a bad thing in theory, but I
haven't had any problems with this approach. It's there to make sure the
welcome dialog is displayed before Sparkle (pre 1.5) asks how the user wants
to check for updates.

Anyway, back to subject. Perhaps a better approach than using timers,
guesswork and voodoo, would be to check the validity of the frame rect and,
if it's zero or garbage, make my own rectangle. How can I do this (validate
rect  get the preferred height of the status bar)?

F.
___

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: Returning a useful error from NSDocument's -readFromURL:...

2010-03-04 Thread Quincey Morris
On Mar 3, 2010, at 13:52, Keith Blount wrote:

 Okay, I know this comes up a lot, but I can't find a single page with a 
 satisfactory solution. Please feel free to post nothing but a link with the 
 solution if I have missed the bloomin’ obvious, of course - this question has 
 been asked here before and in other places, and it seems as though it should 
 be simple, but nothing I try is entirely satisfactory:

No, what you're experiencing doesn't come up a lot.

 My app overrides NSDocument's -readFromURL:ofType:error: to load its data. 
 For the different circumstances in which the load might fail, I want to 
 present to the user an alert panel explaining the reason for the failure. 
 This, as I understand it, is the entire purpose of NSError, except that in 
 this circumstance it seems to be doing more harm than good and just doesn't 
 work as it should.
 
 First, let's say I want to say to the user, Invalid XML Data. And 
 underneath that, in smaller, message text, I want it to say something like, 
 The document cannot be loaded because the XML file contained invalid 
 characters.

You seriously need to read the human interface guidelines. There is a preferred 
pattern laid down for reporting errors, and this isn't it.

 So, here is my error-setting:
 
 if (outError)
 {
 NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
 [userInfo setObject:NSLocalizedString(@Invalid XML Data, @) 
 forKey:NSLocalizedDescriptionKey];
 [userInfo setObject:NSLocalizedString(@The document cannot be loaded because 
 the XML file contained invalid characters.,nil) forKey: 
 NSLocalizedFailureReasonErrorKey];
 
 *outError = [NSError errorWithDomain:@ code:0 userInfo:userInfo];
 }
 
 That works okay, except that the failure reason doesn’t get displayed.

What precisely does works okay mean? Based on what you said above, you seem 
to be saying that you got an alert saying Invalid XML Data.

However, that's not the way the standard document controller reports errors. In 
the simplest case, it just displays a generic message: The document “whatever” 
could not be opened. If you supply a failure reason, it appends that as a 
second sentence. For example, moments ago I created a new project from the 
standard document-based application template (Xcode 3.2, Mac OS X 10.6.2), 
changed the readFromData method to readFromURL:ofType:error: and used your 
code to return an error. I got an alert with the following text:

The document “whatever” could not be opened. The document cannot be loaded 
because the XML file contained invalid characters.

That doesn't sound like the failure reason doesn't get displayed.

 [snip] I have tried to set outError as follows:
 
 if (outError)
 *outError = [NSError errorWithDomain:NSCocoaErrorDomain 
 code:NSUserCancelledError userInfo:nil];
 
 But that results in an alert panel coming up saying nothing more than “Alert” 
 - it still displays an error panel.

I haven't seen any indication that the standard document controller fails to 
handle the NSUserCancelledError correctly (that is, fails to suppress the 
alert).

It sure looks like there's something in your application that's superseding the 
normal error reporting, and doing so incorrectly. If there's truly nothing like 
that in your application, I'd suggest you try to recreate the the behavior 
you're seeing in a new, simple project that starts with the document-based 
application template.

 [snip]
 
 What is the correct way of handling this? It’s bad enough that the user has 
 to see an error message at all (although on some occasions it may be used to 
 tell the user that the project needs updating to a newer format, which is 
 more common than genuine errors), without the error messages seeming 
 unprofessional or unforthcoming in the information they provide. Of course, I 
 could put all of the information into NSLocalizedDescriptionKey, but this 
 looks horrible as it’s all in bold, and would then be one stream of text 
 without a title. Really it should have a title telling the user succinctly 
 that there has been an error an then some message text explaining more about 
 the error and possibly what to do about it.

I'm sorry if it looks horrible to you all in bold. I'm sorry if you feel the 
need for a title -- whatever that means. Seriously (on your way to seriously 
reading the human interface guidelines), get over it. It's to every Mac user's 
benefit if all applications report errors with a consistent presentation and 
style, and that is what the HIG are there to encourage, if not enforce.

I apologize if my response seems churlish, but your original post is basically 
a ragedump and a rant. Churlish is about what it deserves.


___

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:

NSSegmentedControl select multiple cells

2010-03-04 Thread Florian Soenens
Hi List,

i googled this but found nothing relevant.
I want a segmented control with 6 cells that instead of acting like radio 
buttons, they should act as checkboxes, that is, multiple cells should be 
selected.
I tried to set the mode to select any in IB but no no avail.
Also tried setting the mode programmatically, but that doesn't work either.
Every time i click a cell, the others get deselected.

I've seen examples of how to deselect all cells but not how to select multiple.

Anyone has any ideas?

Thanks in advance,
Florian.

Looking for Web-to-Print Solutions?
Visit our website :   http://www.vit2print.com


This e-mail, and any attachments thereto, is intended only for use by the 
addressee(s) named herein and may contain legally privileged and/or 
confidential information and/or information protected by intellectual property 
rights.
If you are not the intended recipient, please note that any review, 
dissemination, disclosure, alteration, printing, copying or transmission of 
this e-mail and/or any file transmitted with it, is strictly prohibited and may 
be unlawful.
If you have received this e-mail by mistake, please immediately notify the 
sender and permanently delete the original as well as any copy of any e-mail 
and any printout thereof.
We may monitor e-mail to and from our network.

NSS nv Tieltstraat 167 8740 Pittem Belgium 
___

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: NSSegmentedControl select multiple cells

2010-03-04 Thread jonat...@mugginsoft.com

On 4 Mar 2010, at 09:28, Florian Soenens wrote:

 Hi List,
 
 i googled this but found nothing relevant.
 I want a segmented control with 6 cells that instead of acting like radio 
 buttons, they should act as checkboxes, that is, multiple cells should be 
 selected.
 I tried to set the mode to select any in IB but no no avail.
 Also tried setting the mode programmatically, but that doesn't work either.
 Every time i click a cell, the others get deselected.
 
 I've seen examples of how to deselect all cells but not how to select 
 multiple.
 
 Anyone has any ideas?
 
Are you using bindings?
Whenever a control seems to be acting counter intuitively I always check my 
bindings' options.

Regards

Jonathan Mitchell

Developer
http://www.mugginsoft.com

___

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


NSLocale and currency symbols

2010-03-04 Thread Frank Illenberger
Hi,

under Mac OS 10.6, an NSLocale seems to contain the information whether a 
currency symbol should be put before the amount or behind it, like in $100.00, 
or 100,00€. 
Sadly, I was not able to find a way to specify this using the NSLocale/CFLocale 
APIs. Is this a private piece of information? Does anybody know how I might 
create a locale with a defined currency symbol behavior?

Thanks and cheers.

Frank


___

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: NSSegmentedControl select multiple cells

2010-03-04 Thread Florian Soenens
No bindings, not even the enabled binding.
I was even wondering if it is uberhaupt possible to select multiple cells in a 
NSSegmentedControl?

On 04 Mar 2010, at 10:43, jonat...@mugginsoft.com wrote:

 
 On 4 Mar 2010, at 09:28, Florian Soenens wrote:
 
 Hi List,
 
 i googled this but found nothing relevant.
 I want a segmented control with 6 cells that instead of acting like radio 
 buttons, they should act as checkboxes, that is, multiple cells should be 
 selected.
 I tried to set the mode to select any in IB but no no avail.
 Also tried setting the mode programmatically, but that doesn't work either.
 Every time i click a cell, the others get deselected.
 
 I've seen examples of how to deselect all cells but not how to select 
 multiple.
 
 Anyone has any ideas?
 
 Are you using bindings?
 Whenever a control seems to be acting counter intuitively I always check my 
 bindings' options.
 
 Regards
 
 Jonathan Mitchell
 
 Developer
 http://www.mugginsoft.com
 



Looking for Web-to-Print Solutions?
Visit our website :   http://www.vit2print.com


This e-mail, and any attachments thereto, is intended only for use by the 
addressee(s) named herein and may contain legally privileged and/or 
confidential information and/or information protected by intellectual property 
rights.
If you are not the intended recipient, please note that any review, 
dissemination, disclosure, alteration, printing, copying or transmission of 
this e-mail and/or any file transmitted with it, is strictly prohibited and may 
be unlawful.
If you have received this e-mail by mistake, please immediately notify the 
sender and permanently delete the original as well as any copy of any e-mail 
and any printout thereof.
We may monitor e-mail to and from our network.

NSS nv Tieltstraat 167 8740 Pittem Belgium 
___

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: NSLocale and currency symbols

2010-03-04 Thread jonat...@mugginsoft.com

On 4 Mar 2010, at 09:51, Frank Illenberger wrote:

 Hi,
 
 under Mac OS 10.6, an NSLocale seems to contain the information whether a 
 currency symbol should be put before the amount or behind it, like in 
 $100.00, or 100,00€. 
 Sadly, I was not able to find a way to specify this using the 
 NSLocale/CFLocale APIs. Is this a private piece of information? Does anybody 
 know how I might create a locale with a defined currency symbol behavior?

Not sure if this will help or not.
You can access the currency symbol suffixes and prefixes from an 
NSNumberFormatter instance configured for currency.

- (NSString *)positivePrefix AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
- (void)setPositivePrefix:(NSString *)string 
AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;

- (NSString *)positiveSuffix AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
- (void)setPositiveSuffix:(NSString *)string 
AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;

- (NSString *)negativePrefix AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
- (void)setNegativePrefix:(NSString *)string 
AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;

- (NSString *)negativeSuffix AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
- (void)setNegativeSuffix:(NSString *)string 
AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;

Regards

Jonathan Mitchell

Developer
http://www.mugginsoft.com
 
 Thanks and cheers.
 
 Frank
 
 
 ___
 
 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/jonathan%40mugginsoft.com
 
 This email sent to jonat...@mugginsoft.com

___

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: NSSegmentedControl select multiple cells

2010-03-04 Thread jonat...@mugginsoft.com
A 10 sec 10.6 demo project - 1 window + 1 NSSegmentedControl - shows this is 
possible.
However, behaviour seems to vary depending on the style of the control.

The textured rounded style seems to like to do its own thing.
Other styles are more well behaved.

Regards

Jonathan Mitchell

Developer
http://www.mugginsoft.com






On 4 Mar 2010, at 10:31, Florian Soenens wrote:

 No bindings, not even the enabled binding.
 I was even wondering if it is uberhaupt possible to select multiple cells in 
 a NSSegmentedControl?
 
 On 04 Mar 2010, at 10:43, jonat...@mugginsoft.com wrote:
 
 
 On 4 Mar 2010, at 09:28, Florian Soenens wrote:
 
 Hi List,
 
 i googled this but found nothing relevant.
 I want a segmented control with 6 cells that instead of acting like radio 
 buttons, they should act as checkboxes, that is, multiple cells should be 
 selected.
 I tried to set the mode to select any in IB but no no avail.
 Also tried setting the mode programmatically, but that doesn't work either.
 Every time i click a cell, the others get deselected.
 
 I've seen examples of how to deselect all cells but not how to select 
 multiple.
 
 Anyone has any ideas?
 
 Are you using bindings?
 Whenever a control seems to be acting counter intuitively I always check my 
 bindings' options.
 
 Regards
 
 Jonathan Mitchell
 
 Developer
 http://www.mugginsoft.com
 
 
 
 
 Looking for Web-to-Print Solutions?
 Visit our website :   http://www.vit2print.com
 
 
 This e-mail, and any attachments thereto, is intended only for use by the 
 addressee(s) named herein and may contain legally privileged and/or 
 confidential information and/or information protected by intellectual 
 property rights.
 If you are not the intended recipient, please note that any review, 
 dissemination, disclosure, alteration, printing, copying or transmission of 
 this e-mail and/or any file transmitted with it, is strictly prohibited and 
 may be unlawful.
 If you have received this e-mail by mistake, please immediately notify the 
 sender and permanently delete the original as well as any copy of any e-mail 
 and any printout thereof.
 We may monitor e-mail to and from our network.
 
 NSS nv Tieltstraat 167 8740 Pittem Belgium 

___

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: NSSegmentedControl select multiple cells

2010-03-04 Thread Florian Soenens
Hi Jonathan,

i just discovered the same thing, my control is Textured Rounded and doesn't 
work, Regular Rounded seems to work fine.
Should i file a bug?

On 04 Mar 2010, at 11:47, jonat...@mugginsoft.com wrote:

 A 10 sec 10.6 demo project - 1 window + 1 NSSegmentedControl - shows this is 
 possible.
 However, behaviour seems to vary depending on the style of the control.
 
 The textured rounded style seems to like to do its own thing.
 Other styles are more well behaved.
 
 Regards
 
 Jonathan Mitchell
 
 Developer
 http://www.mugginsoft.com
 
 
 
 
 
 
 On 4 Mar 2010, at 10:31, Florian Soenens wrote:
 
 No bindings, not even the enabled binding.
 I was even wondering if it is uberhaupt possible to select multiple cells in 
 a NSSegmentedControl?
 
 On 04 Mar 2010, at 10:43, jonat...@mugginsoft.com wrote:
 
 
 On 4 Mar 2010, at 09:28, Florian Soenens wrote:
 
 Hi List,
 
 i googled this but found nothing relevant.
 I want a segmented control with 6 cells that instead of acting like radio 
 buttons, they should act as checkboxes, that is, multiple cells should be 
 selected.
 I tried to set the mode to select any in IB but no no avail.
 Also tried setting the mode programmatically, but that doesn't work either.
 Every time i click a cell, the others get deselected.
 
 I've seen examples of how to deselect all cells but not how to select 
 multiple.
 
 Anyone has any ideas?
 
 Are you using bindings?
 Whenever a control seems to be acting counter intuitively I always check my 
 bindings' options.
 
 Regards
 
 Jonathan Mitchell
 
 Developer
 http://www.mugginsoft.com
 
 
 
 
 Looking for Web-to-Print Solutions?
 Visit our website :   http://www.vit2print.com
 
 
 This e-mail, and any attachments thereto, is intended only for use by the 
 addressee(s) named herein and may contain legally privileged and/or 
 confidential information and/or information protected by intellectual 
 property rights.
 If you are not the intended recipient, please note that any review, 
 dissemination, disclosure, alteration, printing, copying or transmission of 
 this e-mail and/or any file transmitted with it, is strictly prohibited and 
 may be unlawful.
 If you have received this e-mail by mistake, please immediately notify the 
 sender and permanently delete the original as well as any copy of any e-mail 
 and any printout thereof.
 We may monitor e-mail to and from our network.
 
 NSS nv Tieltstraat 167 8740 Pittem Belgium 
 
 ___
 
 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/florian.soenens%40nss.be
 
 This email sent to florian.soen...@nss.be



Looking for Web-to-Print Solutions?
Visit our website :   http://www.vit2print.com


This e-mail, and any attachments thereto, is intended only for use by the 
addressee(s) named herein and may contain legally privileged and/or 
confidential information and/or information protected by intellectual property 
rights.
If you are not the intended recipient, please note that any review, 
dissemination, disclosure, alteration, printing, copying or transmission of 
this e-mail and/or any file transmitted with it, is strictly prohibited and may 
be unlawful.
If you have received this e-mail by mistake, please immediately notify the 
sender and permanently delete the original as well as any copy of any e-mail 
and any printout thereof.
We may monitor e-mail to and from our network.

NSS nv Tieltstraat 167 8740 Pittem Belgium 
___

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: NSSegmentedControl select multiple cells

2010-03-04 Thread jonat...@mugginsoft.com
On 4 Mar 2010, at 10:50, Florian Soenens wrote:

 Hi Jonathan,
 
 i just discovered the same thing, my control is Textured Rounded and doesn't 
 work, Regular Rounded seems to work fine.
 Should i file a bug?
 

Hard to know if this is a bug or just a variant behaviour by design.
Have you checked the HIG guide?

Other controls, especially NSButtons, display this sort of subtle, or not so 
subtle in this case, variation between styles.

Regards

Jonathan Mitchell

Developer
http://www.mugginsoft.com___

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: NSSegmentedControl select multiple cells

2010-03-04 Thread Hado Hein
Florian Soenens florian.soen...@nss.be wrote:
 how to select multiple.

In IB there is an 'selection' option in the attributes inspector for the
behaviour.

Set it from momentary to multiple.

Afterwards you have to handle that in your code like:
   if ( [control isSelectedForSegment:3] )
and the like.



-- 
Hado Hein (KSK, DTHG), master craftsman of stagecrafts, Berlin
sip +49.30.91688488
www.beleuchtungsbildner.de - Stage Lighting Directing
www.batchmaker.de - Stage Lighting Design, Control and Routing
___

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: Returning a useful error from NSDocument's -readFromURL:...

2010-03-04 Thread Keith Blount
Many thanks both for your replies.

As it happens, I need to slap my own forehead for stupidity. I mentioned in my 
e-mail that returning an error with NSLocalizedDescriptionKey and 
NSLocalizedRecoverySuggestionErrorKey used to work, and then foolishly 
assumed it had been an update in Snow Leopard that must have changed something. 
But of course, I was just being an idiot. After reading your replies and 
hearing that what I was doing *should* work, I created a dummy project and 
tried doing the same there (sorry, I really should have done that before 
posting). And of course, it worked fine. So something in my rather large 
project has obviously broken the way errors are displayed.

As I say, I have two problems:

First, if I do this in -readFromURL:ofType:error:

if (outError)
{
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
[userInfo setObject:NSLocalizedString(@Invalid XML Data, @) 
forKey:NSLocalizedDescriptionKey];
[userInfo setObject:NSLocalizedString(@The document cannot be loaded because 
the XML file contained invalid characters.,nil) forKey: 
NSLocalizedRecoverySuggestionErrorKey];

*outError = [NSError errorWithDomain:@ code:0 userInfo:userInfo];
}

only the NSLocalizedDescriptionKey gets displayed in the resulting error panel 
- the recovery suggestion is ignored (even if I enter a domain and non-zero 
code).

Secondly, if I do this:

if (outError)
*outError = [NSError errorWithDomain:NSCocoaErrorDomain 
code:NSUserCancelledError userInfo:nil];

to cancel the error, I still get a panel saying nothing more than Alert.

Well, the second problem was easy enough - it was down to a coding mistake on 
my part. My NSApp delegate implements -application:openFile: and after its call 
to NSDocumentController's -openDocumentWithContentsOfURL:display:error:, 
instead of calling NSDocumentController's -presentError: message, I was calling 
[[NSAlert alertWithError:error] runModal]. So obviously the cancelled error was 
getting put up here, duh.

So that just leaves me to figure out how on earth I have screwed things up so 
that the default error handling doesn't show 
NSLocalizedRecoverySuggestionErrorKey. Clearly something in my code is 
preventing this from happening, although I'm not sure what now. I tried 
commenting out -application:openFile: altogether to allow the file to be opened 
without any of my custom handling procedures, but the error still didn't show 
the recovery suggestion.

Does anyone have any ideas about how you can mess things up so that the 
recovery error wouldn't be shown?

Many thanks and all the best,
Keith


  
___

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: How a window was closed?

2010-03-04 Thread Eric Gorr

On Mar 3, 2010, at 4:30 PM, Graham Cox wrote:

 
 On 04/03/2010, at 3:50 AM, Eric Gorr wrote:
 
 Unfortunately, that knowledge won't help me solve the problem in front of me
 
 But it might help if you told us what the problem in front of you actually 
 was. A simple and obvious solution might then become clear.
 
 Put it this way: apps don't typically need to know why a window is being 
 closed. More generally, object methods shouldn't need to know who called 
 them. The reason you're finding it awkward/difficult to do is because it's 
 unnecessary.

The windows in question are a NSPanels.

One of the questions which must be answered is should this NSPanel be visible 
at the next application launch.

Now, what seems to be common is that if an NSPanel is visible when the 
application is quit, it should be visible at the next launch. Furthermore, if 
the user closes the NSPanel first and then quits the application, the NSPanel 
will not be visible at the next launch.

Now, there are other means that will cause the NSPanel to be closed with 
different answers to whether or not it should be visible at the next launch.

The only method (currently) for closing the panel which seems difficult to 
determine is whether or not the user has clicked in the close (red) button. 
However, it does appear that -windowShouldClose: is the easiest way to do 
it.___

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: Debugging problem

2010-03-04 Thread Keary Suska
On Mar 3, 2010, at 8:24 PM, Laurent Daudelin wrote:

 I'm trying to debug a problem where an NSOutlineView, as part of a drag, 
 tries to create an instance of NSURL using - (id)initWithString:(NSString 
 *)URLString relativeToURL:(NSURL *)baseURL with a nil string and get the 
 following error:
 
 *** Ignoring exception 'NSInvalidArgumentException' (reason '*** -[NSURL 
 initWithString:relativeToURL:]: nil string parameter') raised by 
 NSOutlineView: 0x2d6a1a0 during a dragging session
 
 It happens *after* I write the dragging items to a NSFilesPromisePboardType 
 pasteboard type. I have no idea where this NSURL is created.
 
 I have tried to create a subclass of NSURL and make that class to pose as 
 NSURL but then, I'm getting all kind of unknown messages sent to instances of 
 various classes like:
 
 -[NSCFString absoluteURL]: unrecognized selector sent to instance 0x30e940
 or
 -[%NSURL length]: unrecognized selector sent to instance 0x503930
 
 I also set a future break on [NSException raise] but it's doesn't break on 
 that call.
 
 How can I find where this initWithString:relativeToURL: comes from? The 
 problem is that it doesn't always happen. I tried to reproduce it but so far, 
 I'm not sure what I'm doing different that will trigger the bug. The drag is 
 from my app to the Finder. If I drag from within my app, the error never 
 occurs. It really seems to be with the NSFilesPromisePboardType pasteboard 
 type that this happens.
 
 Anybody have any suggestion?

Do you properly implement -namesOfPromisedFilesDroppedAtDestination: (which is 
required)? Are you providing an array of valid string paths? The drag 
destination would convert the string paths to URLs, so this suggests that you 
are passing it invalid data.

Have you recently re-read Drag and Drop Programming Topics for Cocoa 
(particularly the dragging files section)? That should give you some clues.

Keary Suska
Esoteritech, Inc.
Demystifying technology for your home or business

___

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: Returning a useful error from NSDocument's -readFromURL:...

2010-03-04 Thread Keith Blount
Thanks for your reply. I do appreciate it, although it is a shame that you feel 
the need to be so rude and spoil someone's day. I apologise if my message came 
across as a ragedump and rant. I'm not quite sure why it came across that way 
to you, as I don't think that's what it was at all. I quoted the documentation, 
provided code and explained the problem I was having, and if some frustration 
came through that's perhaps owing to overwork on the next version of my app, so 
I'm sorry for that. Certainly, I made some mistaken assumptions in my previous 
post and didn't check enough before posting. For the record, though, I have 
seriously read the human interface guidelines. The app in question is 
well-respected, has thousands of users, and has been awarded four or five star 
reviews in every major Mac magazine in the US and UK, so please don't assume 
that just because someone is making a silly mistake that they are therefore a 
complete idiot deserving of
 nothing but your scorn. We all make mistakes and bad assumptions from time to 
time, especially when our eyeballs have been staring at a screen for eighteen 
hours a day for weeks on end - if you never make mistakes then I certainly envy 
you.

Now, as to my problem, I had already replied just before you fired off your 
attack, and I have already openly admitted to being an idiot (this is nothing 
new, I'm sure you won't be surprised to learn). In my NSApp delegate code I had 
implemented -application:openFile: to do some custom handling of certain files 
(yes, in the proper way), and I had foolishly used [[NSAlert 
alertWithError:error] runModal] there rather than calling on 
NSDocumentViewController's -presentError: - that, of course, is why 
NSUserCancelledError didn't work and resulted in a blank Error panel. D'oh.

In my other reply I also apologised for not creating a dummy project before 
posting my message - that is something I should have done and I certainly 
deserve chastising for my oversight in that regard. You are of course right 
that errors work fine normally and that something in my project must be to 
blame - I wish I had waited until the morning and checked again rather than 
posting my question at the end of a long day. And, if I use 
NSLocalizedRecoverySuggestionErrorKey in a new Xcode project, the reason for 
the failure appears exactly as I wanted, in message text, beneath the bold. So 
the problem is that there is something else in my application that is somehow 
screwing up the presentation of errors, somehow causing only the localised 
description key to be presented to the user and nixing the recovery suggestion. 
As yet I have no idea what I've done in my code that could have caused this - 
the program has many thousands of lines in code - but it seems
 to be something I've done in the version I'm working on as some more testing 
shows that an earlier version works fine.

Regarding the Human Interface Guidelines, I presume you mean:

http://developer.apple.com/Mac/library/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGWindows/XHIGWindows.html#//apple_ref/doc/uid/2961-TPXREF23

And yes, I am well aware of them, thank you. And as you can see, the HIG give 
three examples. The first shows a poorly written alert message, which is the 
title of the problem in bold. (This is what I'm getting in my app and am trying 
to fix.) The second shows an improved alert message which is still all in 
bold (A because of B). The third is a well-written message, which has both the 
bold and message text. This is what I am trying achieve, and this is how things 
were working until somewhere in my code things went awry. And yes, I am aware 
that technically the reason for the failure should be part of the bold 
message at the top, but if there is no recovery suggestion and the explanation 
for what has gone wrong is going to take several lines, it is better to put it 
in the recovery suggestion area. You could argue and say that you must abide 
exactly by the error definitions, but I would put user experience first in this 
scenario.

I really am sorry that my message provoked such bile in you, and wish you a 
more pleasant day than the one I am now having.

Best regards,
Keith


- Original Message 
From: cocoa-dev-requ...@lists.apple.com cocoa-dev-requ...@lists.apple.com

 Okay, I know this comes up a lot, but I can't find a single page with a 
 satisfactory solution. Please feel free to post nothing but a link with the 
 solution if I have missed the bloomin’ obvious, of course - this question has 
 been asked here before and in other places, and it seems as though it should 
 be simple, but nothing I try is entirely satisfactory:

No, what you're experiencing doesn't come up a lot.

 My app overrides NSDocument's -readFromURL:ofType:error: to load its data. 
 For the different circumstances in which the load might fail, I want to 
 present to the user an alert panel explaining the reason for the failure. 
 This, 

Re: xcode-debug style toolbar above editor area

2010-03-04 Thread Joar Wingfors
Hello Mazen,

You're correct - NSToolbar can only be used at the top of a window. If you want 
to create something that is similar to a toolbar for anywhere else you will 
have to make your own arrangement of controls just like you originally 
suggested.

j o a r


On 3 mar 2010, at 12.41, Mazen M. Abdel-Rahman wrote:

 Thanks for the quick reply.  My understanding was that NSToolBar is 
 specifically meant for windows - i.e. it would get attached to an NSWindow.  
 The tool bar I am referring to in xcode is either a view or attached to a 
 view - and not to a window.  At least that's what it seems like to me.
 
 Thanks,
 Mazen
 
 On Mar 3, 2010, at 1:17 PM, Abhinay Kartik Reddyreddy wrote:
 
 Look for NSToolbar in Interface Builder...
 
 
 On Mar 3, 2010, at 2:01 PM, Mazen M. Abdel-Rahman wrote:
 
 Hi All,
 
 Thanks to everyone for helping me with my previous question.  I had another 
 one though.
 
 When in a debugging session in xcode - but not in the main debug view - a 
 small toolbar appears above the editor.  In my case it's between the 
 editor and the the file name list, and contains debug command buttons (step 
 into, step through, etc.) as well as one button to open the debugger view 
 and another to open the debugger console.
 
 My question is what is the best way to copy this style?  Is it simply a 
 custom NSView with the background set (in code) to grey?  That is my 
 assumption but I thought I would ask.
 
 Thanks!
 Mazen Abdel-Rahman
 ___
 
 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/karthikreddy09%40gmail.com
 
 This email sent to karthikredd...@gmail.com
 
 
 ___
 
 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/joar%40joar.com
 
 This email sent to j...@joar.com

___

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: Debugging problem

2010-03-04 Thread Jens Alfke

On Mar 3, 2010, at 7:24 PM, Laurent Daudelin wrote:

 I also set a future break on [NSException raise] but it's doesn't break on 
 that call.

In recent OS's some exceptions don't go through that bottleneck (such as ones 
raised by CoreFoundation.) The bottleneck to break on is objc_exception_throw. 
Or just choose Run  Stop On Objective-C Exceptions in Xcode.

If you want a way to get a backtrace of the exception without having to run in 
Xcode or gdb, my MYUtilities library has a utility that will dump backtraces:
http://bitbucket.org/snej/myutilities/src/tip/ExceptionUtils.h

—Jens___

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: Anti-aliasing in Snow Leopard (10.6) PDFView

2010-03-04 Thread Andy Mroczkowski
I just encountered this same problem with PDFView on 10.6. The same
code works fine on 10.5.

Did you ever find a solution? Or is there a bug I can reference?


On Mon, Sep 7, 2009 at 5:50 PM, Duncan McGregor dun...@oneeyedmen.com wrote:
 It used to be that PDFView anti-aliased nicely. Now it doesn't, at
 least not for some files. Text and scans rendered in both the
 PDKKitViewer and PDFLinker2 samples are horrible in 10.6.

 I understand that shouldAntiAlias defaults to true, but even setting
 it explicitly does not seem to help. The display is the same as in
 Preview when PDF smoothing is turned off in Preview preferences.

 Am I missing something obvious?

 Thanks in anticipation

 Duncan McGregor
 ___

 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/andy%40mrox.net

 This email sent to a...@mrox.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


Re: Uninitialized rectangle??

2010-03-04 Thread Jens Alfke

On Mar 4, 2010, at 12:42 AM, fabian wrote:

 Right. But why should it matter? The system status bar is not in the nib. 
 Just curious about what is going on behind the scenes...

The status bar is in the menu bar, and the menu bar is in the same nib as your 
app controller. The status bar probably initializes itself in an -awakeFromNib 
method. Whether that method runs before or after your -awakeFromNib method is 
completely unpredictable.

 I can see why it's a bad thing in theory, but I haven't had any problems with 
 this approach.

Are you prepared to have your app crash and burn on launch for every user that 
installs some upcoming OS revision (perhaps even a minor update)? I'm serious; 
this happens. Doing things that shouldn't work, just because they do work at 
the moment, is asking for trouble since the underlying behavior of the system 
frameworks can change in the future.

(This is especially painful if you're not on the expen$ive Apple developer 
plans that get you access to OS betas, because that means you won't get a 
chance to find any of these crashes before your customers do. Instead you find 
yourself frantically debugging on the day the new OS comes out, while your 
mailbox fills up with crash reports and complaints.)

 Anyway, back to subject. Perhaps a better approach than using timers, 
 guesswork and voodoo, would be to check the validity of the frame rect and, 
 if it's zero or garbage, make my own rectangle.

Um, no. Check whether the status bar is nil before you ask for its frame, 
instead of working around the aftermath of calling a struct accessor on nil. 
But doing this is still a hack, for the reason I described above. It's pretty 
clear that you shouldn't be doing anything with NSStatusBar in an -awakeFromNib 
method in the main nib.

—Jens___

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: Anti-aliasing in Snow Leopard (10.6) PDFView

2010-03-04 Thread Duncan McGregor

On 4 Mar 2010, at 16:25, Andy Mroczkowski wrote:

 I just encountered this same problem with PDFView on 10.6. The same
 code works fine on 10.5.
 
 Did you ever find a solution? Or is there a bug I can reference?

Sorry, it turned out to be not high on my list of problems around that time, so 
I didn't pursue it. It still irritates though, so I'd really appreciate a 
heads-up if you find a solution.

Cheers

Duncan
___

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: Private ivars, not marked as IBOutlet, visible in IB

2010-03-04 Thread Lynn Barton
Buck and Yacktman's book Cocoa Design Patterns says on page 208, Any instance 
variable with type id and a name that doesn't start with an underscore 
character is automatically considered an outlet.

Lynn
___

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: Uninitialized rectangle??

2010-03-04 Thread fabian
On Thu, Mar 4, 2010 at 5:28 PM, Jens Alfke j...@mooseyard.com wrote:


 On Mar 4, 2010, at 12:42 AM, fabian wrote:

  Right. But why should it matter? The system status bar is not in the nib.
 Just curious about what is going on behind the scenes...

 The status bar is in the menu bar, and the menu bar is in the same nib as
 your app controller. The status bar probably initializes itself in an
 -awakeFromNib method. Whether that method runs before or after your
 -awakeFromNib method is completely unpredictable.

  I can see why it's a bad thing in theory, but I haven't had any problems
 with this approach.

 Are you prepared to have your app crash and burn on launch for every user
 that installs some upcoming OS revision (perhaps even a minor update)? I'm
 serious; this happens. Doing things that shouldn't work, just because they
 do work at the moment, is asking for trouble since the underlying behavior
 of the system frameworks can change in the future.

 (This is especially painful if you're not on the expen$ive Apple developer
 plans that get you access to OS betas, because that means you won't get a
 chance to find any of these crashes before your customers do. Instead you
 find yourself frantically debugging on the day the new OS comes out, while
 your mailbox fills up with crash reports and complaints.)

  Anyway, back to subject. Perhaps a better approach than using timers,
 guesswork and voodoo, would be to check the validity of the frame rect and,
 if it's zero or garbage, make my own rectangle.

 Um, no. Check whether the status bar is nil before you ask for its frame,
 instead of working around the aftermath of calling a struct accessor on nil.
 But doing this is still a hack, for the reason I described above. It's
 pretty clear that you shouldn't be doing anything with NSStatusBar in an
 -awakeFromNib method in the main nib.

 —Jens


But this is not in -awakeFromNib. That's the whole problem :)

It's in -applicationDidFinishLaunching. Which works great on all systems (as
far as I know), except for on 10.5.8 where NSStatusBar is still nil at this
point. That's what I'm trying to find a work-around for.
___

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: Anti-aliasing in Snow Leopard (10.6) PDFView

2010-03-04 Thread Andy Mroczkowski
Here is a screenshot showing Preview vs PDFLinker2:
http://dl.dropbox.com/u/45634/PDFView-AntiAlias-Issue/PreviewVsPDFView.png

Here is a PDF that exhibits this problem:
http://dl.dropbox.com/u/45634/PDFView-AntiAlias-Issue/PDFView-AntiAlias-Example.pdf

Thank you for your time.
- Andy

On Tue, Sep 8, 2009 at 1:18 PM, John Calhoun calho...@apple.com wrote:
 On Sep 7, 2009, at 3:50 PM, Duncan McGregor wrote:

 It used to be that PDFView anti-aliased nicely. Now it doesn't, at
 least not for some files. Text and scans rendered in both the
 PDKKitViewer and PDFLinker2 samples are horrible in 10.6.

 Can you point to a specific PDF that shows this behavior?

 John Calhoun—___

 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/andy%40mrox.net

 This email sent to a...@mrox.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


Re: Anti-aliasing in Snow Leopard (10.6) PDFView

2010-03-04 Thread Keith Blount
Not sure if this is the same thing, but I recently ran into something similar - 
a scanned-in newspaper looked terrible and grainy in my app, although Preview 
handled it smoothly. The solution was to override -drawPage: in a PDFView 
subclass and set it to use high interpolation if anti-aliasing is turned on, as 
follows:

- (void)drawPage:(PDFPage *)pdfPage
{
[NSGraphicsContextsaveGraphicsState];

// Certain PDF files may appear very grainy (low quality) with the default 
image interpolation. If anti-aliasing is turned on, we therefore
// make interpolation high.
// NOTE: I got this fix from Skim.app's source code, so a credit to 
http://skim-app.sourceforge.net/ goes in the About box.
[[NSGraphicsContextcurrentContext] 
setImageInterpolation:([selfshouldAntiAlias] ? NSImageInterpolationHigh: 
NSImageInterpolationDefault)];

[super drawPage: pdfPage];
[NSGraphicsContextrestoreGraphicsState];
}

(As you can see from the code comments, the developers are Skim are the ones 
who came up with the solution, not me.)

I couldn't see much difference with the PDF you placed in Dropbox, but from the 
comparison image you posted it does look like the same thing.

Hope that helps.

All the best,
Keith


  
___

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: Uninitialized rectangle??

2010-03-04 Thread Kyle Sluder
On Thu, Mar 4, 2010 at 9:05 AM, fabian cocoadevl...@gmail.com wrote:
 It's in -applicationDidFinishLaunching. Which works great on all systems (as
 far as I know), except for on 10.5.8 where NSStatusBar is still nil at this
 point. That's what I'm trying to find a work-around for.

From the -[NSApplication finishLaunching] docs: The run method
invokes this method before it starts the event loop.

Doing AppKit stuff without an event loop always makes me nervous.
Perhaps AppKit is doing some delay-perform stuff, or is waiting on a
runloop input source from the menu manager or window server, or
something else.

You're right, this sounds like something that should Just Work.

--Kyle Sluder
___

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: Anti-aliasing in Snow Leopard (10.6) PDFView

2010-03-04 Thread Andy Mroczkowski
Thanks Keith, that worked perfectly.

On Thu, Mar 4, 2010 at 12:28 PM, Keith Blount keithblo...@yahoo.com wrote:
 Not sure if this is the same thing, but I recently ran into something similar 
 - a scanned-in newspaper looked terrible and grainy in my app, although 
 Preview handled it smoothly. The solution was to override -drawPage: in a 
 PDFView subclass and set it to use high interpolation if anti-aliasing is 
 turned on, as follows:

 - (void)drawPage:(PDFPage *)pdfPage
 {
    [NSGraphicsContextsaveGraphicsState];

    // Certain PDF files may appear very grainy (low quality) with the default 
 image interpolation. If anti-aliasing is turned on, we therefore
 // make interpolation high.
 // NOTE: I got this fix from Skim.app's source code, so a credit to 
 http://skim-app.sourceforge.net/ goes in the About box.
    [[NSGraphicsContextcurrentContext] 
 setImageInterpolation:([selfshouldAntiAlias] ? NSImageInterpolationHigh: 
 NSImageInterpolationDefault)];

    [super drawPage: pdfPage];
    [NSGraphicsContextrestoreGraphicsState];
 }

 (As you can see from the code comments, the developers are Skim are the ones 
 who came up with the solution, not me.)

 I couldn't see much difference with the PDF you placed in Dropbox, but from 
 the comparison image you posted it does look like the same thing.

 Hope that helps.

 All the best,
 Keith




___

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: Uninitialized rectangle??

2010-03-04 Thread fabian
On Thu, Mar 4, 2010 at 6:35 PM, Kyle Sluder kyle.slu...@gmail.com wrote:

 On Thu, Mar 4, 2010 at 9:05 AM, fabian cocoadevl...@gmail.com wrote:
  It's in -applicationDidFinishLaunching. Which works great on all systems
 (as
  far as I know), except for on 10.5.8 where NSStatusBar is still nil at
 this
  point. That's what I'm trying to find a work-around for.

 From the -[NSApplication finishLaunching] docs: The run method
 invokes this method before it starts the event loop.

 Doing AppKit stuff without an event loop always makes me nervous.
 Perhaps AppKit is doing some delay-perform stuff, or is waiting on a
 runloop input source from the menu manager or window server, or
 something else.

 You're right, this sounds like something that should Just Work.

 --Kyle Sluder


One thing that occurred to me: the only non-magical thing that differs
between first run (display dialog, everything works as expected) and second
run (no dialog, no go), is that the app is activated on first run before
putting up the dialog. On second run it is not explicitly brought to front.
Is there any chance adding a [NSApp activateIgnoringOtherApps:YES] statement
in -applicationDidFinishLaunching, just before getting the status bar, could
make a difference? This is a faceless agent, btw.

My code:

- (void) awakeFromNib
{
if ( [[NSUserDefaults standardUserDefaults] boolForKey:@FirstLaunch] )
{
// if this code is executed on 10.5.8, everything works fine. If
not, assertion failure...
[NSApp activateIgnoringOtherApps:YES];
[[NSAlert alertWithMessageText:@Hello defaultButton:@OK
alternateButton:nil otherButton:nil informativeTextWithFormat:@Welcome]
runModal];
}
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NSStatusBar *statusBar = [NSStatusBar systemStatusBar];
statusItem = [[statusBar statusItemWithLength:26] retain];
NSRect frameRect = [[statusItem view] frame];
MyStatusItemView *theView = [[MyStatusItemView alloc]
initWithFrame:frameRect];
[theView setDelegate:self];
[statusItem setView:theView];
[theView release];
}
___

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: How a window was closed?

2010-03-04 Thread Kyle Sluder
On Thu, Mar 4, 2010 at 5:39 AM, Eric Gorr mail...@ericgorr.net wrote:
 The only method (currently) for closing the panel which seems difficult to 
 determine is whether or not the user has clicked in the close (red) button. 
 However, it does appear that -windowShouldClose: is the easiest way to do it.

It might be the easiest, but it seems to me like you might want a more
general-purpose solution, rather than reimplementing the same logic in
every panel's delegate.

// Warning, typed in mail. Probably won't work.
@interface MyPanel : NSPanel {
  BOOL saveVisibility;
}

@implementation MyPanel
- (void)writePreferredVisibilityToUserDefaults:(BOOL)shouldBeVisible {
  // ...
}

- (void)orderWindow:(NSWindowOrderingMode)order relativeTo:(NSInteger)windowNum
{
  if (order != NSWindowOut)
[self writePreferredVisibilityToUserDefaults:YES];

  [super orderWindow:order relativeTo:windowNum];
}

- (void)performClose:(id)sender {
  saveVisibility = YES;
  [super performClose:sender];
}

- (void)close {
  if (saveVisibility)
[self writePreferredVisibilityToUserDefaults:NO];

  [super close];
}

--Kyle Sluder
___

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: Uninitialized rectangle??

2010-03-04 Thread Steven Degutis
Are you sure that your NSStatusBar or NSStatusItem instances are nil, and
not just what's returned from -view? I see no reason that it should be nil,
and no proof that it is. (To be fair, I only skimmed this mess of a thread.)

-Steven

On Thu, Mar 4, 2010 at 12:05 PM, fabian cocoadevl...@gmail.com wrote:

 On Thu, Mar 4, 2010 at 5:28 PM, Jens Alfke j...@mooseyard.com wrote:

 
  On Mar 4, 2010, at 12:42 AM, fabian wrote:
 
   Right. But why should it matter? The system status bar is not in the
 nib.
  Just curious about what is going on behind the scenes...
 
  The status bar is in the menu bar, and the menu bar is in the same nib as
  your app controller. The status bar probably initializes itself in an
  -awakeFromNib method. Whether that method runs before or after your
  -awakeFromNib method is completely unpredictable.
 
   I can see why it's a bad thing in theory, but I haven't had any
 problems
  with this approach.
 
  Are you prepared to have your app crash and burn on launch for every user
  that installs some upcoming OS revision (perhaps even a minor update)?
 I'm
  serious; this happens. Doing things that shouldn't work, just because
 they
  do work at the moment, is asking for trouble since the underlying
 behavior
  of the system frameworks can change in the future.
 
  (This is especially painful if you're not on the expen$ive Apple
 developer
  plans that get you access to OS betas, because that means you won't get a
  chance to find any of these crashes before your customers do. Instead you
  find yourself frantically debugging on the day the new OS comes out,
 while
  your mailbox fills up with crash reports and complaints.)
 
   Anyway, back to subject. Perhaps a better approach than using timers,
  guesswork and voodoo, would be to check the validity of the frame rect
 and,
  if it's zero or garbage, make my own rectangle.
 
  Um, no. Check whether the status bar is nil before you ask for its frame,
  instead of working around the aftermath of calling a struct accessor on
 nil.
  But doing this is still a hack, for the reason I described above. It's
  pretty clear that you shouldn't be doing anything with NSStatusBar in an
  -awakeFromNib method in the main nib.
 
  —Jens


 But this is not in -awakeFromNib. That's the whole problem :)

 It's in -applicationDidFinishLaunching. Which works great on all systems
 (as
 far as I know), except for on 10.5.8 where NSStatusBar is still nil at this
 point. That's what I'm trying to find a work-around for.
 ___

 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/steven.degutis%40gmail.com

 This email sent to steven.degu...@gmail.com




-- 
Steven Degutis
http://www.thoughtfultree.com/
http://www.degutis.org/
___

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: NSImageRep simple code

2010-03-04 Thread John Horigan
It would be a good idea to modify the pixel buffer before calling 
initWithBitmapDataPlanes. NSBitmapImageRep makes no guarantee that changes to 
the data planes will be picked up by the NSBitmapImageRep after the call to 
initWithBitmapDataPlanes. It seems to work with OSX 10.5 and earlier, but Snow 
Leopard lazily copies the data planes to a CGImage. Once that copy happens, 
changes to pixel[] will have no affect on aSimpleBitmap.

-- john

On Mar 3, 2010, at 8:54 PM, Martin Beroiz wrote:

 Hello everyone,
 
 I'm trying to understand how NSImageRep works, so I read the docs and came up 
 with this simple code that seems to... do something. 
 
 I'm confused about what's actually doing, I only see a big black block in my 
 custom view. 
 
 My intention is to make a 2x2 pixels image with different grayscale colors. 
 For example one pixel black, the other white, etc, so I can see if it 
 actually draws the array I'm passing in to NSImageRep.
 
 I'm guessing that the 2x2 pixel image will scale to fit the entire view so I 
 will see the pixels as big squares in the view.
 
 Here's the relevant code:
 
 @implementation PixelsView
 
 - (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
   pixels = (unsigned char *)malloc(4*sizeof(*pixels));
   aSimpleBitmap = [[NSBitmapImageRep alloc] 
 initWithBitmapDataPlanes:pixels 
   
   pixelsWide:2 
   
   pixelsHigh:2
   
bitsPerSample:8 
   
  samplesPerPixel:1 
   
 hasAlpha:NO 
   
 isPlanar:NO 
   
   colorSpaceName:NSDeviceWhiteColorSpace 
   
  bytesPerRow:2
   
 bitsPerPixel:8];
   pixels[0] = 1;
   pixels[1] = 0;
   pixels[2] = 0;
   pixels[3] = 0;
   
}
return self;
 }
 
 - (void)drawRect:(NSRect)dirtyRect {
   NSRect bounds = [self bounds];
   [NSGraphicsContext saveGraphicsState];  
   [aSimpleBitmap drawInRect:bounds];  
   [NSGraphicsContext restoreGraphicsState];
 }
 @end
 
 The docs say that NSDeviceWhiteColorSpace has pure white at 1.0, so I'm 
 guessing that pixels[0] = 1 will set a white pixel, am I wrong?
 
 Xcode is not throwing any errors, but the view is not displaying what I 
 expect. Since I don't fully understand bitmap images, is there anything 
 obvious that I'm missing?
 
 
 
 Thanks in advance.___
 
 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/john%40glyphic.com
 
 This email sent to j...@glyphic.com

___

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: Debugging problem

2010-03-04 Thread Laurent Daudelin
On Mar 4, 2010, at 08:17, Jens Alfke wrote:

 
 On Mar 3, 2010, at 7:24 PM, Laurent Daudelin wrote:
 
 I also set a future break on [NSException raise] but it's doesn't break on 
 that call.
 
 In recent OS's some exceptions don't go through that bottleneck (such as ones 
 raised by CoreFoundation.) The bottleneck to break on is 
 objc_exception_throw. Or just choose Run  Stop On Objective-C Exceptions in 
 Xcode.
 
 If you want a way to get a backtrace of the exception without having to run 
 in Xcode or gdb, my MYUtilities library has a utility that will dump 
 backtraces:
   http://bitbucket.org/snej/myutilities/src/tip/ExceptionUtils.h

Thanks, Jens, I'll have a look!

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@gmail.com
Photo Gallery Store: 
http://laurentdaudelin.shutterbugstorefront.com/g/galleries___

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: Uninitialized rectangle??

2010-03-04 Thread fabian
On Thu, Mar 4, 2010 at 6:50 PM, Steven Degutis steven.degu...@gmail.comwrote:

 Are you sure that your NSStatusBar or NSStatusItem instances are nil, and
 not just what's returned from -view? I see no reason that it should be nil,
 and no proof that it is. (To be fair, I only skimmed this mess of a thread.)

 -Steven


No, I'm not. It just boiled down to this assumption along the way somehow.
Perhaps to make the thread less messy :)

But you are absolutely right: all I know for sure is that whatever is
returned from [view frame] is causing the unitialized rectangle assertion
failure.



 On Thu, Mar 4, 2010 at 12:05 PM, fabian cocoadevl...@gmail.com wrote:

 On Thu, Mar 4, 2010 at 5:28 PM, Jens Alfke j...@mooseyard.com wrote:

 
  On Mar 4, 2010, at 12:42 AM, fabian wrote:
 
   Right. But why should it matter? The system status bar is not in the
 nib.
  Just curious about what is going on behind the scenes...
 
  The status bar is in the menu bar, and the menu bar is in the same nib
 as
  your app controller. The status bar probably initializes itself in an
  -awakeFromNib method. Whether that method runs before or after your
  -awakeFromNib method is completely unpredictable.
 
   I can see why it's a bad thing in theory, but I haven't had any
 problems
  with this approach.
 
  Are you prepared to have your app crash and burn on launch for every
 user
  that installs some upcoming OS revision (perhaps even a minor update)?
 I'm
  serious; this happens. Doing things that shouldn't work, just because
 they
  do work at the moment, is asking for trouble since the underlying
 behavior
  of the system frameworks can change in the future.
 
  (This is especially painful if you're not on the expen$ive Apple
 developer
  plans that get you access to OS betas, because that means you won't get
 a
  chance to find any of these crashes before your customers do. Instead
 you
  find yourself frantically debugging on the day the new OS comes out,
 while
  your mailbox fills up with crash reports and complaints.)
 
   Anyway, back to subject. Perhaps a better approach than using timers,
  guesswork and voodoo, would be to check the validity of the frame rect
 and,
  if it's zero or garbage, make my own rectangle.
 
  Um, no. Check whether the status bar is nil before you ask for its
 frame,
  instead of working around the aftermath of calling a struct accessor on
 nil.
  But doing this is still a hack, for the reason I described above. It's
  pretty clear that you shouldn't be doing anything with NSStatusBar in an
  -awakeFromNib method in the main nib.
 
  —Jens


 But this is not in -awakeFromNib. That's the whole problem :)

 It's in -applicationDidFinishLaunching. Which works great on all systems
 (as
 far as I know), except for on 10.5.8 where NSStatusBar is still nil at
 this
 point. That's what I'm trying to find a work-around for.
 ___

 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/steven.degutis%40gmail.com

 This email sent to steven.degu...@gmail.com




 --
 Steven Degutis
 http://www.thoughtfultree.com/
 http://www.degutis.org/

___

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: Anti-aliasing in Snow Leopard (10.6) PDFView

2010-03-04 Thread Duncan McGregor
And thanks from me too. Creative inertia triumphs once again ;-)

Duncan

On 4 Mar 2010, at 17:43, Andy Mroczkowski wrote:

 Thanks Keith, that worked perfectly.
 
 On Thu, Mar 4, 2010 at 12:28 PM, Keith Blount keithblo...@yahoo.com wrote:

...___

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: How a window was closed?

2010-03-04 Thread Eric Gorr

On Mar 4, 2010, at 12:49 PM, Kyle Sluder wrote:

 // Warning, typed in mail. Probably won't work.
 @interface MyPanel : NSPanel {
  BOOL saveVisibility;
 }
 
 @implementation MyPanel
 - (void)writePreferredVisibilityToUserDefaults:(BOOL)shouldBeVisible {
  // ...
 }
 
 - (void)orderWindow:(NSWindowOrderingMode)order 
 relativeTo:(NSInteger)windowNum
 {
  if (order != NSWindowOut)
[self writePreferredVisibilityToUserDefaults:YES];
 
  [super orderWindow:order relativeTo:windowNum];
 }
 
 - (void)performClose:(id)sender {
  saveVisibility = YES;
  [super performClose:sender];
 }
 
 - (void)close {
  if (saveVisibility)
[self writePreferredVisibilityToUserDefaults:NO];
 
  [super close];
 }

This potential solution seems to rely on -performClose: being called when the 
user presses the close button. However, in my testing, this method was not 
called. It seemed to me that the intent of -performClose: was to simulate the 
click on the close button, not to respond to it.




___

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: Messaging Cocoa apps through Terminal

2010-03-04 Thread Jeffrey Oleander
 On Wed, 2010/03/03, Matt Neuburg m...@tidbits.com wrote:
 From: Matt Neuburg m...@tidbits.com
 Subject: Re: Messaging Cocoa apps through Terminal
 To: Ulai Beekam ulaibee...@hotmail.com
 Cc: cocoa-dev@lists.apple.com
 Date: Wednesday, 2010 March 03, 13:02
 On Wed, 2010 Mar 03 16:17:13 +,
 Ulai Beekam ulaibee...@hotmail.com
 said:
get the point. Just so the user (but mainly the
 developer for testing purposes) can somehow
 make the app do things that cannot be done
 in the UI.

 This might be a reason to build some scriptability
 (AppleScript-type) into the app. In fact, it is
 the usual reason. Granted, it might also be
 overkill for your app. But it's a very good way
 to build in some hidden preferences.
 
 On the other hand if you are just saying you want
 to automate the choosing of a certain menu item
 or pushing of a certain button 100 times, you
 could use GUI scripting without bothering to
 make your app scriptable at all. GUI scripting
 is a very good poor man's way to automate
 interface testing, and on Cocoa apps it just
 works, out of the box, for most interfaces. m.

I'd like something like this just to make my apps
properly interruptible.


  
___

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: Help Book Icon in Xcode 3.2

2010-03-04 Thread Matt Neuburg
On Wed, 3 Mar 2010 11:02:50 -0800, Kyle Sluder kyle.slu...@gmail.com said:
On Mar 3, 2010, at 10:34 AM, Gabriel Fernandez
fernandez.g...@att.net wrote:

 why don't YOU read that documentation and try it out? I wouldn't
 have asked if I didn't already search the archives, and oh yeah,
 forgot about GOOGLE! Smart-guy.

You made no indication that you had tried anything at all. If you
can't find the answer in the documentation, or if you have followed
the documentation and it isn't working, please mention that.

Perhaps I should have linked you to whathaveyoutried.com instead. Have
you in fact followed the instructions in Specifying a Help Book Icon?

To be fair, though, after some offline communication, I find that the OP's
confusion seems owing more to the state of the documentation on this point.
The first page of the Apple Help Programming Guide gives the explicit
impression that the reader is about to be told how to construct Apple Help
for any system including 10.4 or later. However, when we get to the third
page (Authoring Apple Help) we are told that the way to get an icon is to
use the HPDBookIconPath key in the Info.plist file - instructions which
apply only if you are using the new bundle-based help book format, which
works only in 10.6. There is no mention whatever of the AppleIcon meta tag,
which is what is needed. The only way to find out about it is to look in the
legacy document, which is hardly easy to discover:

http://developer.apple.com/legacy/mac/library/documentation/UserExperience/
Conceptual/LegacyAppleHelpConcepts/user_help_intro/user_assistance_intro.htm
l

m.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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: Uninitialized rectangle??

2010-03-04 Thread Steven Degutis
Right. Have you tried the solution I proposed in the /very first reply/ to
this thread?

-Steven

On Thu, Mar 4, 2010 at 1:05 PM, fabian cocoadevl...@gmail.com wrote:

 On Thu, Mar 4, 2010 at 6:50 PM, Steven Degutis 
 steven.degu...@gmail.comwrote:

 Are you sure that your NSStatusBar or NSStatusItem instances are nil, and
 not just what's returned from -view? I see no reason that it should be nil,
 and no proof that it is. (To be fair, I only skimmed this mess of a thread.)

 -Steven


 No, I'm not. It just boiled down to this assumption along the way somehow.
 Perhaps to make the thread less messy :)

 But you are absolutely right: all I know for sure is that whatever is
 returned from [view frame] is causing the unitialized rectangle assertion
 failure.



 On Thu, Mar 4, 2010 at 12:05 PM, fabian cocoadevl...@gmail.com wrote:

  On Thu, Mar 4, 2010 at 5:28 PM, Jens Alfke j...@mooseyard.com wrote:

 
  On Mar 4, 2010, at 12:42 AM, fabian wrote:
 
   Right. But why should it matter? The system status bar is not in the
 nib.
  Just curious about what is going on behind the scenes...
 
  The status bar is in the menu bar, and the menu bar is in the same nib
 as
  your app controller. The status bar probably initializes itself in an
  -awakeFromNib method. Whether that method runs before or after your
  -awakeFromNib method is completely unpredictable.
 
   I can see why it's a bad thing in theory, but I haven't had any
 problems
  with this approach.
 
  Are you prepared to have your app crash and burn on launch for every
 user
  that installs some upcoming OS revision (perhaps even a minor update)?
 I'm
  serious; this happens. Doing things that shouldn't work, just because
 they
  do work at the moment, is asking for trouble since the underlying
 behavior
  of the system frameworks can change in the future.
 
  (This is especially painful if you're not on the expen$ive Apple
 developer
  plans that get you access to OS betas, because that means you won't get
 a
  chance to find any of these crashes before your customers do. Instead
 you
  find yourself frantically debugging on the day the new OS comes out,
 while
  your mailbox fills up with crash reports and complaints.)
 
   Anyway, back to subject. Perhaps a better approach than using timers,
  guesswork and voodoo, would be to check the validity of the frame rect
 and,
  if it's zero or garbage, make my own rectangle.
 
  Um, no. Check whether the status bar is nil before you ask for its
 frame,
  instead of working around the aftermath of calling a struct accessor on
 nil.
  But doing this is still a hack, for the reason I described above. It's
  pretty clear that you shouldn't be doing anything with NSStatusBar in
 an
  -awakeFromNib method in the main nib.
 
  —Jens


 But this is not in -awakeFromNib. That's the whole problem :)

 It's in -applicationDidFinishLaunching. Which works great on all systems
 (as
 far as I know), except for on 10.5.8 where NSStatusBar is still nil at
 this
 point. That's what I'm trying to find a work-around for.
 ___

 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/steven.degutis%40gmail.com

 This email sent to steven.degu...@gmail.com




 --
 Steven Degutis
 http://www.thoughtfultree.com/
 http://www.degutis.org/





-- 
Steven Degutis
http://www.thoughtfultree.com/
http://www.degutis.org/
___

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: Private ivars, not marked as IBOutlet, visible in IB

2010-03-04 Thread Joanna Carter

Le 4 mars 2010 à 16:31, Lynn Barton a écrit :

 Buck and Yacktman's book Cocoa Design Patterns says on page 208, Any 
 instance variable with type id and a name that doesn't start with an 
 underscore character is automatically considered an outlet.

That is understandable... if the ivars have not otherwise been marked as 
@private.

I have no problem with this concept of default behaviour, if it is for legacy 
purposes but, with the new visibility specifiers, these should take precedence 
of the older legacy rules.

Never mind, as long as you prepend the private ivar with an underscore, it 
disappears :-)

Joanna

--
Joanna Carter
Carter Consulting

___

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: Uninitialized rectangle??

2010-03-04 Thread fabian
On Thu, Mar 4, 2010 at 7:47 PM, Steven Degutis steven.degu...@gmail.comwrote:

 Right. Have you tried the solution I proposed in the /very first reply/ to
 this thread?

 -Steven


Actually, no. I don't have 10.5.8, so I would have to send it to one of the
end-users to try, and I feel hesitant to bother a customer without having a
clue _why_ the changes made to the code would make any difference. I did
send you a reply, though, asking why you think feeding a dummy view to the
status item would give better results. I'm not questioning your suggestion,
I'd just like to hear the arguments for it before proceeding.



 On Thu, Mar 4, 2010 at 1:05 PM, fabian cocoadevl...@gmail.com wrote:

 On Thu, Mar 4, 2010 at 6:50 PM, Steven Degutis 
 steven.degu...@gmail.comwrote:

 Are you sure that your NSStatusBar or NSStatusItem instances are nil, and
 not just what's returned from -view? I see no reason that it should be nil,
 and no proof that it is. (To be fair, I only skimmed this mess of a thread.)

 -Steven


 No, I'm not. It just boiled down to this assumption along the way somehow.
 Perhaps to make the thread less messy :)

 But you are absolutely right: all I know for sure is that whatever is
 returned from [view frame] is causing the unitialized rectangle assertion
 failure.



  On Thu, Mar 4, 2010 at 12:05 PM, fabian cocoadevl...@gmail.com wrote:

  On Thu, Mar 4, 2010 at 5:28 PM, Jens Alfke j...@mooseyard.com wrote:

 
  On Mar 4, 2010, at 12:42 AM, fabian wrote:
 
   Right. But why should it matter? The system status bar is not in the
 nib.
  Just curious about what is going on behind the scenes...
 
  The status bar is in the menu bar, and the menu bar is in the same nib
 as
  your app controller. The status bar probably initializes itself in an
  -awakeFromNib method. Whether that method runs before or after your
  -awakeFromNib method is completely unpredictable.
 
   I can see why it's a bad thing in theory, but I haven't had any
 problems
  with this approach.
 
  Are you prepared to have your app crash and burn on launch for every
 user
  that installs some upcoming OS revision (perhaps even a minor update)?
 I'm
  serious; this happens. Doing things that shouldn't work, just because
 they
  do work at the moment, is asking for trouble since the underlying
 behavior
  of the system frameworks can change in the future.
 
  (This is especially painful if you're not on the expen$ive Apple
 developer
  plans that get you access to OS betas, because that means you won't
 get a
  chance to find any of these crashes before your customers do. Instead
 you
  find yourself frantically debugging on the day the new OS comes out,
 while
  your mailbox fills up with crash reports and complaints.)
 
   Anyway, back to subject. Perhaps a better approach than using
 timers,
  guesswork and voodoo, would be to check the validity of the frame rect
 and,
  if it's zero or garbage, make my own rectangle.
 
  Um, no. Check whether the status bar is nil before you ask for its
 frame,
  instead of working around the aftermath of calling a struct accessor
 on nil.
  But doing this is still a hack, for the reason I described above. It's
  pretty clear that you shouldn't be doing anything with NSStatusBar in
 an
  -awakeFromNib method in the main nib.
 
  —Jens


 But this is not in -awakeFromNib. That's the whole problem :)

 It's in -applicationDidFinishLaunching. Which works great on all systems
 (as
 far as I know), except for on 10.5.8 where NSStatusBar is still nil at
 this
 point. That's what I'm trying to find a work-around for.
 ___

 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/steven.degutis%40gmail.com

 This email sent to steven.degu...@gmail.com




 --
 Steven Degutis
 http://www.thoughtfultree.com/
 http://www.degutis.org/





 --
 Steven Degutis
 http://www.thoughtfultree.com/
 http://www.degutis.org/

___

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


PopupButtonCell in a TableView column

2010-03-04 Thread Lynn Barton
I am trying to display my model data in an NSTableView where one integer 
property is represented by a popup menu in the first column of the table. I 
have searched the archives and seen that some others have done the same and 
asked for assistance, but none of the answers I found were complete enough for 
me to find the solution.

With a model entity of (let's say) MyData and an array controller of 
MyDataArrayController, and two properties myIntProperty and myStringProperty, 
the tableview works perfectly without the popup menu. In this case, the first 
column has a text cell and a number formatter, and the column is bound to 
MyDataArrayController.arrangedObjects.myIntProperty. The second column is bound 
to MyDataArrayController.arrangedObjects.myStringProperty.

Then I created another array controller, MyMenuArrayController (super is 
NSArrayController), which builds a fixed array of 3 NSStrings. That array 
becomes the arrangedObjects property of the controller.

After removing the number formatter, and placing an NSPopupButtonCell in the 
first column of the table, I have tried many different bindings, and none of 
them worked. I always get the console error message  [NSTableColumn 
0x200083e20 valueForUndefinedKey:]: this class is not key value 
coding-compliant for the key value.

The problem is made worse by the fact that even if I reverse the changes made 
from the previous, working configuration, putting the text cell and the number 
formatter in place of the popupbutton cell, the same error occurs. I have to 
use Time Machine to load the previous project files in order to get rid of the 
error.

(1) What key value should be used with an NSString object in an array? 
description perhaps?
(2) What are the correct bindings to use?
(3) When the user changes the selected  item in the popup menu, will that be 
automatically reflected in the value of myIntProperty?
(4) Why does the error persist after I reverse the changes to the tableview?
(5) Am I not providing the menu's array of strings in a correct way?

This has me stumped, so any help will be greatly appreciated.

Lynn Barton
___

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: Uninitialized rectangle??

2010-03-04 Thread Steven Degutis
NSStatusItem's -view and -setView: methods are related to your own custom
view, and have nothing to do with the view it internally uses. Thus, it
initially has no view until you give it one. So, giving it a dummy view via
[statusItem setView: [[[NSView alloc] init] autorelease] ] is going to allow
you to access that view's -window and thus the -frame of the NSWindow. Keep
in mind though that this is a hack, and also usually very unnecessary and
bad and against the HIG in the first place.

-Steven

On Thu, Mar 4, 2010 at 2:01 PM, fabian cocoadevl...@gmail.com wrote:

 On Thu, Mar 4, 2010 at 7:47 PM, Steven Degutis 
 steven.degu...@gmail.comwrote:

 Right. Have you tried the solution I proposed in the /very first reply/ to
 this thread?

 -Steven


 Actually, no. I don't have 10.5.8, so I would have to send it to one of the
 end-users to try, and I feel hesitant to bother a customer without having a
 clue _why_ the changes made to the code would make any difference. I did
 send you a reply, though, asking why you think feeding a dummy view to the
 status item would give better results. I'm not questioning your suggestion,
 I'd just like to hear the arguments for it before proceeding.



 On Thu, Mar 4, 2010 at 1:05 PM, fabian cocoadevl...@gmail.com wrote:

 On Thu, Mar 4, 2010 at 6:50 PM, Steven Degutis steven.degu...@gmail.com
  wrote:

 Are you sure that your NSStatusBar or NSStatusItem instances are nil,
 and not just what's returned from -view? I see no reason that it should be
 nil, and no proof that it is. (To be fair, I only skimmed this mess of a
 thread.)

 -Steven


 No, I'm not. It just boiled down to this assumption along the way
 somehow. Perhaps to make the thread less messy :)

 But you are absolutely right: all I know for sure is that whatever is
 returned from [view frame] is causing the unitialized rectangle assertion
 failure.



  On Thu, Mar 4, 2010 at 12:05 PM, fabian cocoadevl...@gmail.comwrote:

  On Thu, Mar 4, 2010 at 5:28 PM, Jens Alfke j...@mooseyard.com
 wrote:

 
  On Mar 4, 2010, at 12:42 AM, fabian wrote:
 
   Right. But why should it matter? The system status bar is not in
 the nib.
  Just curious about what is going on behind the scenes...
 
  The status bar is in the menu bar, and the menu bar is in the same
 nib as
  your app controller. The status bar probably initializes itself in an
  -awakeFromNib method. Whether that method runs before or after your
  -awakeFromNib method is completely unpredictable.
 
   I can see why it's a bad thing in theory, but I haven't had any
 problems
  with this approach.
 
  Are you prepared to have your app crash and burn on launch for every
 user
  that installs some upcoming OS revision (perhaps even a minor
 update)? I'm
  serious; this happens. Doing things that shouldn't work, just because
 they
  do work at the moment, is asking for trouble since the underlying
 behavior
  of the system frameworks can change in the future.
 
  (This is especially painful if you're not on the expen$ive Apple
 developer
  plans that get you access to OS betas, because that means you won't
 get a
  chance to find any of these crashes before your customers do. Instead
 you
  find yourself frantically debugging on the day the new OS comes out,
 while
  your mailbox fills up with crash reports and complaints.)
 
   Anyway, back to subject. Perhaps a better approach than using
 timers,
  guesswork and voodoo, would be to check the validity of the frame
 rect and,
  if it's zero or garbage, make my own rectangle.
 
  Um, no. Check whether the status bar is nil before you ask for its
 frame,
  instead of working around the aftermath of calling a struct accessor
 on nil.
  But doing this is still a hack, for the reason I described above.
 It's
  pretty clear that you shouldn't be doing anything with NSStatusBar in
 an
  -awakeFromNib method in the main nib.
 
  —Jens


 But this is not in -awakeFromNib. That's the whole problem :)

 It's in -applicationDidFinishLaunching. Which works great on all
 systems (as
 far as I know), except for on 10.5.8 where NSStatusBar is still nil at
 this
 point. That's what I'm trying to find a work-around for.
 ___

 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/steven.degutis%40gmail.com

 This email sent to steven.degu...@gmail.com




 --
 Steven Degutis
 http://www.thoughtfultree.com/
 http://www.degutis.org/





 --
 Steven Degutis
 http://www.thoughtfultree.com/
 http://www.degutis.org/





-- 
Steven Degutis
http://www.thoughtfultree.com/
http://www.degutis.org/
___

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

Please do not post admin requests or moderator comments to the list.
Contact the 

Re: NSImageRep simple code

2010-03-04 Thread Ken Ferry
This is true, and was true on 10.5 (and 10.4) as well though the timing has
changed some.  The AppKit release notes have commentary on it.

This is a bit of an API problem.  In order to draw a bitmap in Quartz, the
data must be packaged as a CGImage, which is immutable.  This means the
client and AppKit need to agree on when it is legal for a client to be
looking at the bitmapData.   -bitmapData by itself tells AppKit that the
client wants to look at (or mess with) the data, but there's way for the
client to communicate when it is done.

What actually happens is that repacking as a CGImage happens lazily.  So if
you ask for bitmapData, modify the data, and draw the bitmap, then repacking
happens at that draw stage.  Further attempts to directly access to the
memory after that point is bad - may crash, may not crash but also not
affect drawing.

The code wrote will work as is, because you haven't taken any action that
would cause the NSBitmapImageRep to pack things up as a CGImage.  However, I
agree, to stay away from the edges of things I would set up the data before
making the bitmap, not after.  Alternately it would be more explicit (and
thus safer) to call -bitmapData and modify the data returned, but that's
unnecessary here, you can just have the data set up right on input.

(If you're wondering about threading implications, see the AppKit release
notes.)

-Ken

On Thu, Mar 4, 2010 at 9:57 AM, John Horigan j...@glyphic.com wrote:

 It would be a good idea to modify the pixel buffer before calling
 initWithBitmapDataPlanes. NSBitmapImageRep makes no guarantee that changes
 to the data planes will be picked up by the NSBitmapImageRep after the call
 to initWithBitmapDataPlanes. It seems to work with OSX 10.5 and earlier, but
 Snow Leopard lazily copies the data planes to a CGImage. Once that copy
 happens, changes to pixel[] will have no affect on aSimpleBitmap.

 -- john

 On Mar 3, 2010, at 8:54 PM, Martin Beroiz wrote:

  Hello everyone,
 
  I'm trying to understand how NSImageRep works, so I read the docs and
 came up with this simple code that seems to... do something.
 
  I'm confused about what's actually doing, I only see a big black block in
 my custom view.
 
  My intention is to make a 2x2 pixels image with different grayscale
 colors. For example one pixel black, the other white, etc, so I can see if
 it actually draws the array I'm passing in to NSImageRep.
 
  I'm guessing that the 2x2 pixel image will scale to fit the entire view
 so I will see the pixels as big squares in the view.
 
  Here's the relevant code:
 
  @implementation PixelsView
 
  - (id)initWithFrame:(NSRect)frame {
 self = [super initWithFrame:frame];
 if (self) {
pixels = (unsigned char *)malloc(4*sizeof(*pixels));
aSimpleBitmap = [[NSBitmapImageRep alloc]
 initWithBitmapDataPlanes:pixels
 
   pixelsWide:2
 
   pixelsHigh:2
 
bitsPerSample:8
 
  samplesPerPixel:1
 
 hasAlpha:NO
 
 isPlanar:NO
 
   colorSpaceName:NSDeviceWhiteColorSpace
 
  bytesPerRow:2
 
 bitsPerPixel:8];
pixels[0] = 1;
pixels[1] = 0;
pixels[2] = 0;
pixels[3] = 0;
 
 }
 return self;
  }
 
  - (void)drawRect:(NSRect)dirtyRect {
NSRect bounds = [self bounds];
[NSGraphicsContext saveGraphicsState];
[aSimpleBitmap drawInRect:bounds];
[NSGraphicsContext restoreGraphicsState];
  }
  @end
 
  The docs say that NSDeviceWhiteColorSpace has pure white at 1.0, so I'm
 guessing that pixels[0] = 1 will set a white pixel, am I wrong?
 
  Xcode is not throwing any errors, but the view is not displaying what I
 expect. Since I don't fully understand bitmap images, is there anything
 obvious that I'm missing?
 
 
 
  Thanks in advance.___
 
  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/john%40glyphic.com
 
  This email sent to j...@glyphic.com

 ___

 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/kenferry%40gmail.com

 This email sent to kenfe...@gmail.com

___

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


Dealing with glyphs that draw outside their NSTextView

2010-03-04 Thread Ross Carter
In a new TextEdit Wrap to Page document, change the font to Zapfino and type 
a lowercase f. The left swash is cut off. I would like to draw the entire 
glyph, as Pages does (and I am aware that Pages does not use NSTextView).

It's easy enough to draw the entire glyph by sending -lockFocus to the 
NSTextView's superview before the NSLayoutManager sends 
drawGlyphsForGlyphRange:atPoint:. The problem is determining what part of the 
superview needs to be redrawn when the glyph is moved or deleted.

NSLayoutManager boundingRectForGlyphRange:inTextContainer: is supposed to 
determine the area that contains all drawing performed for a range of glyphs. 
However, the rect it returns does not include the complete area drawn by the 
glyph (the method returns a width of 6.5, while the width of the glyph is 
38.87, as determined by NSFont -boundingRectForGlyph:). 

Is there a way to determine the rect or rects actually drawn by 
drawGlyphsForGlyphRange:atPoint:? Or, is there a better approach to insuring 
that all parts of every glyph are drawn?

-Ross
___

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


Tracing which objects get an event

2010-03-04 Thread Brian Postow
I'm writing a mozilla plugin on the mac. I'm trying to capture events like 
button clicks, etc. I've done the normal thing of creating my views in inteface 
builder, and linking the sentActions to methods in my program. This works in 
stand-alone programs.

However, in my NPAPI plugin, those methods never get called. The button reacts, 
depresses, whatever, but it doesn't do its action.

Instead, the NPP_HandleEvent method gets called, but I never get the MouseDown 
or MouseUp event, only the UpdateEvt.

I set up the buttons to accept clicks via: (superview is the Mozilla view, 
topview is the top of my view hierarchy.)

[superView setNextResponder: topView];
[topView  setNextResponder: nil];
[browserWindow makeFirstResponder: topView];

Basically, I'm confused because the fact that the button is reacting, means to 
me that the button is getting the event. However that should mean that the Sent 
Action should take place, but it isn't. Similarly, if the button is getting the 
event, then the browser shouldn't be getting it at all, and so it shouldn't be 
sending me an NPP_HandleEvent message... 

Is there some way to sort this out? (Also, note: this is a mozilla plugin, and 
Firefox doesn't like to run in the debugger, so the debugger doesn't work...)


Brian Postow
Senior Software Engineer
Acordex Imaging Systems

___

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: PopupButtonCell in a TableView column

2010-03-04 Thread Matt Neuburg
On Thu, 04 Mar 2010 11:03:49 -0800, Lynn Barton lynnbar...@mac.com said:
With a model entity of (let's say) MyData and an array controller of
MyDataArrayController, and two properties myIntProperty and myStringProperty,
the tableview works perfectly without the popup menu. In this case, the first
column has a text cell and a number formatter, and the column is bound to
MyDataArrayController.arrangedObjects.myIntProperty. The second column is bound
to MyDataArrayController.arrangedObjects.myStringProperty.

Then I created another array controller, MyMenuArrayController (super is
NSArrayController), which builds a fixed array of 3 NSStrings. That array
becomes the arrangedObjects property of the controller.

You can't bind to an array of strings because a string is not key
value-coding compliant. You should bind to an array of NSMutableDictionary,
even if these dictionaries each contain just one key-value pair. There's a
reason why this is the default.

After removing the number formatter, and placing an NSPopupButtonCell in the
first column of the table, I have tried many different bindings, and none of
them worked. I always get the console error message  [NSTableColumn
0x200083e20 valueForUndefinedKey:]: this class is not key value
coding-compliant for the key value.

This is a frequently asked question. It would help if Apple would use
quotation marks in this error message. This means you have asked something
for the value of a key called @value, but the thing you are asking for
this key doesn't have a key by that name. (If, as I said above, it's a
string, it doesn't have *any* keys; that's why, if you aren't going to
supply your own key-value compliant class, you want to use a dictionary,
which does have keys.)

In short, bindings depend upon KVC (key-value coding). It might be helpful
for you to review the documentation on KVC.

m.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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: Sorting contents of an NSCollectionView

2010-03-04 Thread Eli Bach

On Mar 3, 2010, at 3:39 PM, Eli Bach wrote:

 I have a core-data app, with a view that shows a managed object, along with 
 an NSCollectionView displaying related managed objects in 1 column, all 
 hooked together primarily with bindings.
 
 This works fine (selecting different objects automatically updates the 
 collectionview and I can add/edit/delete related objects).
 
 However, I would like to present the related records in the same order each 
 time, as well as have new objects appear in a predicable location (namely, at 
 one 'end' of the collectionview.  I have an 'order' attribute, with 
 NSInteger16 values, that I want to sort on.
 
 Just adding a NSSortDescriptor to the NSArrayController that the 
 NSCollectionView gets it's managed objects from only partially works:
 
 1) it ONLY does the sort if I have a button that changes the sort AFTER the 
 array is fully populated.  Setting the sortDescriptor on the 
 NSArrayController when the view loads, or even as the root managed object is 
 changed, doesn't result in the collectionview being sorted
 
 2) adding or deleting a related record [removing/adding objects for the 
 collectionview] randomizes the order of the objects presented in the 
 collectionview [either by calling add: on the NSArrayController or directly 
 creating a new NSManagedObject for the relation].  The object is 
 presented/removed, but the order is always rearranged randomly.
 
 I've even tried (programmatically):
 -add/delete record
 -clear sort descriptor
 -set sort descriptor
 
 and it does do the sort.  It only applies the sort if I hit a button that 
 changes the sortDescriptor on the NSArrayController AFTER the collectionview 
 gets fully populated.
 
 Any ideas on the best way to keep the nsarraycontroller and/or the 
 nscollectionview sorted all the time?

To follow up on this, I've found what seems to be a stupid 'solution' to this, 
namely subclass NSArrayController and override one method with this:

- (NSArray *)arrangeObjects:(NSArray *)objects
{
NSArray *   returnValue = objects;
NSArray *   sortDescriptors = [self sortDescriptors];

if ((sortDescriptors != nil)  ([sortDescriptors count]  0))
{
returnValue = [objects 
sortedArrayUsingDescriptors:sortDescriptors];
}
else
{
returnValue = [super arrangeObjects:objects];
}

return returnValue;
}

This results in the collectionview being sorted.

But I expected the arraycontroller to do this automatically just by setting 
sortdescriptor, and perhaps setAutomaticallyRearrangesObjects:YES, on the 
arraycontroller, but it doesn't seem to reliably apply the sort by itself.

Am I misunderstanding NSArrayController, or binding the collectionview to the 
wrong part [it's bound to arrangedObjects], or a bug in NSArrayController?

Eli

___

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: Returning a useful error from NSDocument's -readFromURL:...

2010-03-04 Thread Keith Blount
Aha, found the solution to this one at last. Many thanks to Charles, Jerry and 
Quincey for the help and pointers, and apologies to Quincey if I overreacted to 
his reply - it's been one of those weeks where the code seems to be leading to 
even more code rather than making progress. Anyway, in case anyone else comes 
across a similar problem - probably unlikely given that they are rather unique 
circumstances, but you never know - here is the problem and the solution.

The problem:
1. In my NSDocument subclass's -readFromURL:ofType:error: method, no matter 
what information I put into the NSError object, the dialogue would only ever 
display NSLocalizedDescriptionKey, and never NSLocalizedFailureReasonErrorKey 
or NSLocalizedRecoverySuggestionErrorKey.
2. If I tried to present my own error and use NSCocoaErrorDomain and 
NSUserCancelledError to cancel the original error, I would still get a blank 
dialog saying Alert.

The solution - or rather, pilot error:
1. I recently added some third-party code to my app to provide a 
shortcut-recorder control (which is a great control, by the way):
http://code.google.com/p/shortcutrecorder
However, I was using an older version of their code that had an NSError 
category (in the SRCommon files) that returns -localizedRecoverySuggestion, 
-localizedFailureReason and so on (presumably the category was written before 
10.4 introduced these methods), and these methods were obviously taking the 
place of the 10.4+ AppKit methods but make some (now) bad assumptions and 
return nothing - thus messing up NSError. Getting rid of this unnecessary 
category makes NSError work as it should again (but it looks like they have 
newer code I need to update to anyway).
2. In one of my document opening methods called in my NSApp delegate class, I 
had been calling [[NSAlert alertWithError:error] runModal] instead of 
[[NSDocumentController sharedDocumentController] presentError:error]. So 
obviously NSAlert was showing a blank error for NSUserCancelledError when 
-presentError:, which is what I should have used, would have ignored it.

Apologies for wasting everyone's time with what was essentially user-error, but 
thanks for the pointers that eventually led me to the solution after much 
head-butting of the desk.

All the best,
Keith


  
___

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: Tracing which objects get an event

2010-03-04 Thread Brian Postow
D'oh. Never mind. I was looking at the wrong method. It *IS* using the 
sent-actions. 


Brian Postow
Senior Software Engineer
Acordex Imaging Systems

___

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


-[NSManagedObject objectID]: unrecognized selector sent to class

2010-03-04 Thread Matt Bigarani
Hey all,

I'm experiencing some weirdness with NSManagedObject. Basic
background, I have an NSManagedObject 'surveyGroup', which has a
to-many relationship to another NSManagedObject, surveyResults.

I'm attempting to access the surveyResults object in two different
methods. It works fine in the first method, but in the second method I
get the error:

-[NSManagedObject objectID]: unrecognized selector sent to class

When trying to access any of the properties of the surveyResult
object. If I comment out the first method, the second method is able
to access the properties of the surveyResult object without error.

Am I doing anything obviously wrong here that would leave surveyResult
un-usable the next time I try to access it?

NSUInteger index = 0;
NSMutableSet *surveyResultSet = [group mutableSetValueForKey:@survey_results];
NSMutableArray * surveyResultArray = [[NSMutableArray alloc] init];
[surveyResultArray addObjectsFromArray:[surveyResultSet allObjects]];

NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc]
initWithKey:@date ascending:YES];
[surveyResultArray sortUsingDescriptors:[NSArray
arrayWithObject:sortDescriptor]];
[sortDescriptor release];

NSManagedObject * surveyResult = [surveyResultArray objectAtIndex:index];
NSManagedObject * survey   = [surveyResult valueForKey:@survey];
NSString * surveyName = [survey valueForKey:@name];

NSString * title = [NSString stringWithFormat:@%@, surveyName];

[surveyResultArray release];

return title;
___

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


Interface Builder : moving a controller to File's Owner

2010-03-04 Thread David Geldreich

Hello,

I am refactoring one big NIB file into smaller pieces. I copy/paste a  
WindowController object and a Window object in a new empty NIB.


I end up having

File's Owner
First Responder
Application
WindowController
Window

I would like to move WindowController as File's Owner and keep all the  
connections. How could I do this in InterfaceBuilder ?


Thanks in advance.

David
___

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: How a window was closed?

2010-03-04 Thread Graham Cox

On 05/03/2010, at 12:39 AM, Eric Gorr wrote:

 Now, there are other means that will cause the NSPanel to be closed with 
 different answers to whether or not it should be visible at the next launch.


It's not clear to me why. You only need to record whether the panel is 
currently open or closed in the user defaults. If the app quits in the 'open' 
state it opens the panels at next launch. For recording the closed state, the 
NSWindowWillCloseNotification looks useful. For open state, there isn't an 
equivalent notification but its controller should know when this is.

--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: Interface Builder : moving a controller to File's Owner

2010-03-04 Thread Kyle Sluder
On Thu, Mar 4, 2010 at 1:45 PM, David Geldreich david.geldre...@free.fr wrote:
 I am refactoring one big NIB file into smaller pieces. I copy/paste a
 WindowController object and a Window object in a new empty NIB.

Window controllers don't belong in nibs. You create them in code and
ask them to load a nib, at which point they fill in as File's Owner
(unless you use the variant in which you provide a different File's
Owner, but you almost never actually want to use that).

--Kyle Sluder
___

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: NSOutlineView: items can't be referenced with path?

2010-03-04 Thread Corbin Dunn

On Mar 4, 2010, at 1:20 PM, Laurent Daudelin wrote:

 I've been using NSOutlineView in the past and know the need to provide a 
 unique identifier for items used by the outline view.
 
 I'm working on a WebDAV client and thought it would be a good idea to use the 
 full url of an item to identify it. However, after I properly provide the 
 path for items in outlineView:child:ofItem:, when my 
 outlineView:isItemExpandable: is called, item is nil.
 
 Anybody knows what's up with that? I'm using a string formatted as a URL, 
 e.g. http://192.168.0.1/SomeContent/SomeDirectory/SomeFile;.
 

It returns whatever you gave it from child:ofItem: -- you must be passing nil 
to it.

corbin



___

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


Converting a Cocoa Application project to a document-based one

2010-03-04 Thread Josh de Lioncourt
Hi all,

First the question, in essence, is:

If one starts with a project built using the Cocoa Application template, what 
steps are involved in changing that existing project to what Xcode will 
recognize as a Cocoa Document-based application?

The background:

I'm using a customized template for building a Cocoa application using the 
Renaissance framework, which is provided as part of the RenaissanceX 
distribution headed by Brian Smart.

The Renaissance framework requires you use its own GSMarkupDocument class 
instead of the NSDocument one.

I can sub-class GSMarkupDocument just fine, and have tried to replicate 
everything from the Cocoa Application for Document-Based apps template, but I 
must be missing a crucial step somewhere, as the app does not provide any of 
the basic functionality one would expect from a document-based app.

Any help with this would be appreciated.

Thanks.

Josh

___

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


Get my custom object from NSDictionary variable

2010-03-04 Thread Daniel Káčer

Hi,

i solve the following problem:

a add my custom object into NSDictionary variable in my application  
with following code:


[myDictionary setObject:[[ComplexObject alloc] initWithFrom:_tempFrom  
pairTo:string] forKey:[NSString stringWithFormat:@%d, [myDictionary  
count]]];


.. it seems, that this work correctly ..

but .. when i will retrieve value from my custom object from this  
NSDictionary variable, there is some issue ... and i don't know, what  
i do wrongly in this case ...


int iRandom = arc4random() % ([myDictionary count] - 1);
ComplexObject* compObj = [myDictionary objectForKey:[NSString  
stringWithFormat:@%d, iRandom]];

NSString* sText = [compObj valueFrom];   --- on this line is some issue

-
This is interface of my custom object:

@interface ComplexObject : NSObject
NSString* sValueFrom;
NSString* sValueTo;

-(ComplexObject*) initWithFrom:(NSString*)_sValueFrom pairTo: 
(NSString*)_sValueTo;

-(NSString*) valueFrom;
-(NSString*) valueTo;
@end

and this is implementatio of my custom object:
@implementation ComplexObject

- (NSString*) valueFrom {
return sValueFrom;
}

- (NSString*) valueTo {
return sValueTo;
}

- (ComplexObject*)initWithFrom:(NSString*)_sValueFrom pairTo: 
(NSString*)_sValueTo {

self = [super init];

if (self) {
sValueFrom = _sValueFrom;
sValueTo = _sValueTo;
}
return self;
}

@end

___

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: Get my custom object from NSDictionary variable

2010-03-04 Thread Graham Cox

On 05/03/2010, at 10:48 AM, Daniel Káčer wrote:

 a add my custom object into NSDictionary variable in my application with 
 following code:
 
 [myDictionary setObject:[[ComplexObject alloc] initWithFrom:_tempFrom 
 pairTo:string] forKey:[NSString stringWithFormat:@%d, [myDictionary 
 count]]];
 
 .. it seems, that this work correctly ..

Except it's leaking. Don't put the alloc...init inside another statement. For 
one thing, if it fails you'll throw instead of continue. But more importantly, 
you don't have a reference to the object to release it once the dictionary has 
taken ownership, so it leaks.

 but .. when i will retrieve value from my custom object from this 
 NSDictionary variable, there is some issue ... and i don't know, what i do 
 wrongly in this case ...
 
 int iRandom = arc4random() % ([myDictionary count] - 1);
 ComplexObject* compObj = [myDictionary objectForKey:[NSString 
 stringWithFormat:@%d, iRandom]];
 NSString* sText = [compObj valueFrom];   --- on this line is some issue

Well, what is the issue?

 - (ComplexObject*)initWithFrom:(NSString*)_sValueFrom 
 pairTo:(NSString*)_sValueTo {
self = [super init];
 
if (self) {
sValueFrom = _sValueFrom;
sValueTo = _sValueTo;
}
return self;
 }

Simply assigning the strings to the ivars is inadequate. You also need to 
retain them, so I'm guessing the 'issue' is that you get an EXC_BAD_ACCESS 
because the returned references are stale.

You need to read this. Take three times a day every four hours.

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html

Also, your naming conventions and use of underscores is all over the place.

--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: Get my custom object from NSDictionary variable

2010-03-04 Thread Daniel Káčer

thank you very much ...
This was the problem !




On Mar 5, 2010, at 0:57 , Thomas Wetmore wrote:

You need to retain your member variables in the initializer.

On Mar 4, 2010, at 6:48 PM, Daniel Káčer wrote:

- (ComplexObject*)initWithFrom:(NSString*)_sValueFrom pairTo: 
(NSString*)_sValueTo {

  self = [super init];

  if (self) {
  sValueFrom = _sValueFrom;  should be sValueFrom =  
[_sValueFrom retain];

  sValueTo = _sValueTo;  similarly here...
  }
  return self;
}



___

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: NSLocale and currency symbols

2010-03-04 Thread Deborah Goldsmith
Mac OS X doesn’t use the concept of “before” or “after”. Instead, there’s a 
currency formatting pattern which has the currency symbol metacharacter 
embedded in it.

Please read the documentation on NSNumberFormatter for more information.

Deborah Goldsmith
Apple Inc.
golds...@apple.com

On Mar 4, 2010, at 1:51 AM, Frank Illenberger wrote:

 Hi,
 
 under Mac OS 10.6, an NSLocale seems to contain the information whether a 
 currency symbol should be put before the amount or behind it, like in 
 $100.00, or 100,00€. 
 Sadly, I was not able to find a way to specify this using the 
 NSLocale/CFLocale APIs. Is this a private piece of information? Does anybody 
 know how I might create a locale with a defined currency symbol behavior?
 
 Thanks and cheers.
 
 Frank
 
 
 ___
 
 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/goldsmit%40apple.com
 
 This email sent to golds...@apple.com


___

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: -[NSManagedObject objectID]: unrecognized selector sent to class

2010-03-04 Thread Fritz Anderson
On 4 Mar 2010, at 1:32 PM, Matt Bigarani wrote:

 I'm attempting to access the surveyResults object in two different
 methods. It works fine in the first method, but in the second method I
 get the error:
 
 -[NSManagedObject objectID]: unrecognized selector sent to class
 
 When trying to access any of the properties of the surveyResult
 object. If I comment out the first method, the second method is able
 to access the properties of the surveyResult object without error.

It's not clear what you mean by two methods. I see only one attempt to pull a 
property out of an apparent surveyResult:
NSManagedObject * survey = [surveyResult valueForKey:@survey];

Perhaps your next listing could indicate what code you are commenting-out. Are 
you sure you're showing us all of your code? 

— F

___

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


NSSegmentedControl

2010-03-04 Thread David Blanton

Is it possible to change the height of an NSSegmentedControl?

IB gives access the the width of segments but not height.

If subclass what would the method be to change the height?

-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: NSSegmentedControl

2010-03-04 Thread Eli Bach

On Mar 4, 2010, at 8:40 PM, David Blanton wrote:

 Is it possible to change the height of an NSSegmentedControl?
 
 IB gives access the the width of segments but not height.
 
 If subclass what would the method be to change the height?
 
 -db

Could it just be that it's the height of the view?

Eli

___

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: Get my custom object from NSDictionary variable

2010-03-04 Thread Matt Neuburg
On Fri, 5 Mar 2010 00:48:05 +0100, Daniel K??er donaldi...@gmail.com said:

[myDictionary setObject:[[ComplexObject alloc] initWithFrom:_tempFrom
pairTo:string] forKey:[NSString stringWithFormat:@%d, [myDictionary
count]]];

.. it seems, that this work correctly ..

Not really. You're leaking a ComplexObject instance here, since you alloc it
but never release it. So, since you're making a memory management mistake
here, maybe you're making others elsewhere.

Also, what does seems mean? Have you inspected myDictionary to see whether
it is in *fact* what you expect?

NSString* sText = [compObj valueFrom];   --- on this line is some issue

How about revealing *what* issue? m.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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: -[NSManagedObject objectID]: unrecognized selector sent to class

2010-03-04 Thread Joanna Carter
Hi Matt

Le 4 mars 2010 à 19:32, Matt Bigarani a écrit :

 I'm experiencing some weirdness with NSManagedObject. Basic
 background, I have an NSManagedObject 'surveyGroup', which has a
 to-many relationship to another NSManagedObject, surveyResults.
 
 I'm attempting to access the surveyResults object in two different
 methods. It works fine in the first method, but in the second method I
 get the error:
 
 -[NSManagedObject objectID]: unrecognized selector sent to class

If that is the exact code that is being quoted, then the problem is that you 
are sending the objectID message to the NSManagedObject class, not to an 
instance of the class.

Joanna

--
Joanna Carter
Carter Consulting
___

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