NSArrayController Selection and Managed Object Context Undo

2011-10-06 Thread Richard Somers
It is very common for Applications to update the selection during undo operations. By default NSArrayController automatically selects objects as they are inserted. This works if objects are added using one of the controller's add or insert methods. If objects are added directly to the

Re: Writing a simple vector graphics editor - how to implement?

2011-10-06 Thread Nick
Thanks a lot for the advices! Will do it that way ___ 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

adding something to a setter

2011-10-06 Thread Torsten Curdt
The property syntax is great until you need one more thing. Think of a NSView and that view displays a value. @synthesize value; Now you also want to setNeedsDisplay: when a new value is set. So one can override the setter. - (void)setValue:(NSString*)theValue { ... [self

Re: Windows _findfirst , _findnext (koko)

2011-10-06 Thread Sander Stoks
Thanks for all the input. I am doing x-platform development and we like to keep mainline code identical so I implemented functions _findfirst and _findnext using NSFileManager ... it work s pretty cool as follows: intptr_t _findfirst(CString search, _finddata_t *data) { intptr_t rtx

Re: adding something to a setter

2011-10-06 Thread Thomas Davie
I don't know of any better way than simply writing the setters yourself. One thing I'd love to see apple add to the language is allowing us to specify a code block to be included in setter and getting in the synthesize: @property (readwrite, retain, nonatomic) NSString *theValue; @synthesize

Re: adding something to a setter

2011-10-06 Thread Mike Abdullah
On 6 Oct 2011, at 13:09, Thomas Davie wrote: I don't know of any better way than simply writing the setters yourself. One thing I'd love to see apple add to the language is allowing us to specify a code block to be included in setter and getting in the synthesize: @property (readwrite,

Re: adding something to a setter

2011-10-06 Thread Stephan Michels
I use KVO to execute custom code if a property has changed. [self addObserver:self forKeyPath:@graphics options:(NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld) context:self]; - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change

Re: adding something to a setter

2011-10-06 Thread Thomas Davie
On 6 Oct 2011, at 13:36, Mike Abdullah wrote: On 6 Oct 2011, at 13:09, Thomas Davie wrote: Does anyone have any comments on why that might not work, before I file a bug report to request it? Well it would become rather unreadable for anything more than a single line of code. I'm

Re: adding something to a setter

2011-10-06 Thread Torsten Curdt
Hm... using KVO for an object to observe it's own properties? That's feels wrong to me. Is that just me? cheers, Torsten ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list.

Re: adding something to a setter

2011-10-06 Thread Thomas Davie
On 6 Oct 2011, at 14:16, Torsten Curdt wrote: Hm... using KVO for an object to observe it's own properties? That's feels wrong to me. Is that just me? No, definitely not just you... But then, I find KVO pretty wrong in the first place. if (*ra4 != 0xffc78948) { return false; }

Re: adding something to a setter

2011-10-06 Thread glenn andreas
On Oct 6, 2011, at 6:28 AM, Torsten Curdt wrote: The property syntax is great until you need one more thing. Think of a NSView and that view displays a value. @synthesize value; Now you also want to setNeedsDisplay: when a new value is set. So one can override the setter. -

Re: adding something to a setter

2011-10-06 Thread Peter
But probably that bad feeling is self-inflicted ... At least for standard views or controls, if there is a need to redisplay, the property in question should probably belong to a model object not a view object. And in that case your object would not observe its *own* property but a property of

NSPrintInfo and NSPageLayout

2011-10-06 Thread Torsten Curdt
So I have a custom view and I am adding printing support. I've set it up like this: https://gist.github.com/919d845b2e1b5becbaac where I create a custom instance of my view, setup the NSPrintInfo and then run the NSPrintOperation. Now there are a couple of things I couldn't quite figure out

Re: adding something to a setter

2011-10-06 Thread Torsten Curdt
Well, if the model is more complex and you bind the view to the model you can of course trigger the re-display on the observed changes. But what about a simple title property of e.g. a NSButton? ...and I guess triggering a re-display is not the only use case for this setter extension - or

Re: adding something to a setter

2011-10-06 Thread Stephan Michels
Am 06.10.2011 um 15:54 schrieb Torsten Curdt: Well, if the model is more complex and you bind the view to the model you can of course trigger the re-display on the observed changes. But what about a simple title property of e.g. a NSButton? ...and I guess triggering a re-display is not the

Re: NSArrayController Selection and Managed Object Context Undo

2011-10-06 Thread Keary Suska
On Oct 6, 2011, at 1:14 AM, Richard Somers wrote: It is very common for Applications to update the selection during undo operations. By default NSArrayController automatically selects objects as they are inserted. This works if objects are added using one of the controller's add or

Re: adding something to a setter

2011-10-06 Thread Andy Lee
On Oct 6, 2011, at 9:16 AM, Torsten Curdt wrote: Hm... using KVO for an object to observe it's own properties? That's feels wrong to me. Is that just me? You could factor the observing out into a separate object. I'm just rattling this idea off the top of my head, so it might be flawed (if

Re: adding something to a setter

2011-10-06 Thread Mike Abdullah
On 6 Oct 2011, at 15:23, Stephan Michels wrote: Am 06.10.2011 um 15:54 schrieb Torsten Curdt: Well, if the model is more complex and you bind the view to the model you can of course trigger the re-display on the observed changes. But what about a simple title property of e.g. a NSButton?

Re: adding something to a setter

2011-10-06 Thread Andy Lee
On Oct 6, 2011, at 10:55 AM, Andy Lee wrote: It observes a fake view property called myNeedsDisplay. Here is a totally untested MyDisplayTickler class, plus a category on NSView: https://gist.github.com/1267594 Oops, in my code I called the fake property needsTickle, not myNeedsDisplay.

How to blink with a focus ring of the text box?

2011-10-06 Thread Nick
Hello I am wondering if there's a way to do this, notifying the user that he can't enter any more text into NSTextField edit box? Is there a way to change the color of the NSTextField's focus ring to red (to highlight that this is an error)? How difficult would that be to implement? Thank you!

Re: How to blink with a focus ring of the text box?

2011-10-06 Thread Thomas Davie
The correct way to notify a user that he can't enter text in a text box is to disabled it. Bob if (*ra4 != 0xffc78948) { return false; } On 6 Oct 2011, at 16:33, Nick wrote: Hello I am wondering if there's a way to do this, notifying the user that he can't enter any more text into

Re: How to blink with a focus ring of the text box?

2011-10-06 Thread Peter
Read carefully: The original poster stated: any more text - or are you suggesting that he should disable the text box when a certain number of characters are reached? I guess not. AFAIK, the focus ring is not accessible programmatically, except form setting it by making something the first

Re: How to blink with a focus ring of the text box?

2011-10-06 Thread Gary L. Wade
I'm guessing you're wanting this for invalid characters as well as exceeded number of characters? It sounds like an intriguing extension to the UI. It might be easier to flash a red translucent overlay on the field contents instead. -- Gary L. Wade (Sent from my iPhone) http://www.garywade.com/

Re: How to blink with a focus ring of the text box?

2011-10-06 Thread Peter
Adding to my own post I just found this in my snippets collection: This listing shows how you draw such a focus ring. It requires you to override the NSCell drawWithFrame:inView: In this method, if the cell is supposed to draw evidence of first-responder status, set the rectangle for the focus

Re: How to blink with a focus ring of the text box?

2011-10-06 Thread Scott Ribe
On Oct 6, 2011, at 9:54 AM, Gary L. Wade wrote: I'm guessing you're wanting this for invalid characters as well as exceeded number of characters? It sounds like an intriguing extension to the UI. It might be easier to flash a red translucent overlay on the field contents instead. Or some

Re: How to blink with a focus ring of the text box?

2011-10-06 Thread Lee Ann Rucker
On Oct 6, 2011, at 9:12 AM, Scott Ribe wrote: On Oct 6, 2011, at 9:54 AM, Gary L. Wade wrote: I'm guessing you're wanting this for invalid characters as well as exceeded number of characters? It sounds like an intriguing extension to the UI. It might be easier to flash a red translucent

Re: NSArrayController Selection and Managed Object Context Undo

2011-10-06 Thread Quincey Morris
On Oct 6, 2011, at 07:40 , Keary Suska wrote: AFAIK you will need to manage selection restoration semantics yourself, and it may not be easy and it may be fragile. Note also that the preserve and avoid empty selection settings will also have an effect. That being said, the approach would

Why doesn't UIViewController retain its UISearchDisplayController

2011-10-06 Thread Heath Borders
In the UIViewController documentation about the searchDisplayController property [1] it says: If you create your search display controller programmatically, this property is set automatically by the search display controller when it is initialized. And when I create my UISearchDisplayController

Re: adding something to a setter

2011-10-06 Thread Quincey Morris
On Oct 6, 2011, at 04:28 , Torsten Curdt wrote: Now you also want to setNeedsDisplay: when a new value is set. So one can override the setter. - (void)setValue:(NSString*)theValue { ... [self setNeedsDisplay:YES]; } but - you would have to implement the setter yourself. No big

Re: Strange mystery with Core Animation

2011-10-06 Thread Seth Willits
On Oct 4, 2011, at 10:20 PM, Seth Willits wrote: Can anyone offer any explanation for this? Hmm. That would be an interesting one to play with if you can replicate it in a new project. The weirdest one I've come across is the CALayer convertPoint methods actually break CATransactions

Re: Codesign non-AppStore build with AppStore signing identity

2011-10-06 Thread Charles Srstka
On Oct 5, 2011, at 1:15 PM, Trygve Inda wrote: One of our apps (distributed via our website) is not signed. It seems that Parental Controls signs our app behind our back to do what it does. This obviously alters our app and breaks some integrity checks. A Tech Note says that simply

Re: How to blink with a focus ring of the text box?

2011-10-06 Thread Quincey Morris
On Oct 6, 2011, at 08:33 , Nick wrote: Is there a way to change the color of the NSTextField's focus ring to red (to highlight that this is an error)? I think this sounds like a *terrible* idea. Not because it's a terrible idea, but because introducing yet another subtle[-ish]

Re: Strange mystery with Core Animation

2011-10-06 Thread Kyle Sluder
On Thu, Oct 6, 2011 at 12:47 PM, Seth Willits sli...@araelium.com wrote: Hmm. That would be an interesting one to play with if you can replicate it in a new project. The weirdest one I've come across is the CALayer convertPoint methods actually break CATransactions (sometimes). Which I've

Re: adding something to a setter

2011-10-06 Thread Kyle Sluder
On Thu, Oct 6, 2011 at 12:33 PM, Quincey Morris quinceymor...@rivergatesoftware.com wrote: By all means use self-observation if that solves your problem. There's absolutely nothing wrong with it, so any negative feelings you might have are just another perceptual problem. Note, however, that

Re: Strange mystery with Core Animation

2011-10-06 Thread Seth Willits
On Oct 6, 2011, at 1:06 PM, Kyle Sluder wrote: On Thu, Oct 6, 2011 at 12:47 PM, Seth Willits sli...@araelium.com wrote: Hmm. That would be an interesting one to play with if you can replicate it in a new project. The weirdest one I've come across is the CALayer convertPoint methods actually

Adding Import to a document based application

2011-10-06 Thread Jeff Smith
Hi, I want to add Import to a document based application but wasn't quite sure if I was going about it right. I was going to override runModalOpenPanel:forTypes to set forTypes to the import types and invoke URLsFromRunningOpenPanel. A flag would be set so runModalOpenPanel:forTypes would

Re: adding something to a setter

2011-10-06 Thread Andy Lee
On Oct 6, 2011, at 4:12 PM, Kyle Sluder wrote: On Thu, Oct 6, 2011 at 12:33 PM, Quincey Morris quinceymor...@rivergatesoftware.com wrote: [...] Note, however, that because the observer mechanism is so clunky, you're going to write *more* lines of code this way than in overriding the setter,

Re: adding something to a setter

2011-10-06 Thread Torsten Curdt
I think it really doesn't suck. You've just been lucky enough so far to be able to ride around on synthesized setters, so an override feels bad. Get over it already! Just because I can now synthesize setters doesn't make it suck less. Over it or under it ;) The intend of this mail was not to

Re: adding something to a setter

2011-10-06 Thread Torsten Curdt
The superclass approach is sneaky ...didn't think about that. Again, though, I remain unconvinced that going to all this trouble is worth it, just to eliminate a lingering sense of unease. Perhaps a short course of therapy instead? LOL - maybe :) Well, TBH this is less of I want to use this

Re: adding something to a setter

2011-10-06 Thread Charles Srstka
On Oct 6, 2011, at 6:22 PM, Quincey Morris wrote: It occurs to me that there may be a lower-tech solution. If you created an abstract superclass of the class whose setters you wanted to override, you could synthesize the properties in the superclass, override them normally, and call super

Re: adding something to a setter

2011-10-06 Thread Quincey Morris
On Oct 6, 2011, at 17:12 , Charles Srstka wrote: But isn't creating a whole abstract superclass for this a lot more of a hassle than just making a private property? *Some* more. I'm not sure about a *lot* more. What would you get from that approach that you wouldn’t get from just having

-[NSURLCredentialStorage removeCredential:forProtectionSpace:] broken?

2011-10-06 Thread Jim Correia
Is there a known problem with -[NSURLCredentialStorage removeCredential:forProtectionSpace:], or are my expectations wrong? I iterate all the credials in the storage looking for the one I wish to remove, then send -removeCredential:forProtectionSpace: to the instance, and it doesn't actually

Re: adding something to a setter

2011-10-06 Thread Jim Correia
Do not use self as your observation context. Your observation context has to be unique for all observers of the object. “self” is a bad choice. Also, you should only do your own work in the case that the observer is your observer. In the code below, you are also doing your work in the case

Re: NSPrintInfo and NSPageLayout

2011-10-06 Thread Ken Thomases
On Oct 6, 2011, at 8:46 AM, Torsten Curdt wrote: 1) Currently I set the width of the view to the page size width minus the left and right margin. Frankly speaking I have no clue if that is the right thing to do. Or is imageablePageBounds the one to use? I'm not sure. I know that you can get

Missing header files/folders?

2011-10-06 Thread Shane Stanley
I've just bought a new Mac, and after migrating and updating I notice that inside the frameworks in /System/Library/Frameworks/, the Headers link and Headers folder that appear on my old Mac are not to be found on my old one. Should they be there, or are the ones on my old Mac a relic of

Re: adding something to a setter

2011-10-06 Thread Yi Lin
It's perhaps helpful to remember that property was introduce to remove the annoyance with having to define boilerplate accessor for 90% of your properties. People are now writing 90% less accessor code, so writing one more for your case below seems tolerable. After all, it's just a few lines of

Re: How to blink with a focus ring of the text box?

2011-10-06 Thread Yi Lin
Another way is to make the cursor stop at the end of the limit, and if the user keeps banging on the keyboard, show an alert message stating the character limit on the field. On Thu, Oct 6, 2011 at 8:33 AM, Nick eveningn...@gmail.com wrote: Hello I am wondering if there's a way to do this,

Re: Missing header files/folders?

2011-10-06 Thread Jens Alfke
On Oct 6, 2011, at 9:09 PM, Shane Stanley wrote: I've just bought a new Mac, and after migrating and updating I notice that inside the frameworks in /System/Library/Frameworks/, the Headers link and Headers folder that appear on my old Mac are not to be found on my old one. Should they be

Re: Missing header files/folders?

2011-10-06 Thread Joar Wingfors
On 6 okt 2011, at 22:38, Jens Alfke wrote: On Oct 6, 2011, at 9:09 PM, Shane Stanley wrote: I've just bought a new Mac, and after migrating and updating I notice that inside the frameworks in /System/Library/Frameworks/, the Headers link and Headers folder that appear on my old Mac are

[Moderator] Again - Mourning the loss of Steve

2011-10-06 Thread Scott Anguish
I don’t want to write about this again, but there is something I can offer that might help some of you. I’ve gotten some personal emails that were truly touching. There is an address you can send your emails of condolence, memories, thanks, etc. rememberingst...@apple.com This is a tough

Re: Missing header files/folders?

2011-10-06 Thread Shane Stanley
On 07/10/2011, at 4:42 PM, Joar Wingfors wrote: All the bits and pieces of an Xcode install doesn't survive a migration. You have to reinstall Xcode. That did the trick. I'd assumed Xcode was only responsible for the ones in /Developer/. Many thanks. -- Shane Stanley