Re: Find panel problems

2011-09-20 Thread jonat...@mugginsoft.com
On 20 Sep 2011, at 02:12, Ryan Joseph wrote: Maybe I'm not understanding how the system works (where are the find panel docs anyways?) but I simply have an NSTextView with setUsesFindPanel enabled and when I open the find panel (from the standard menu item) all the buttons have been

bindings confusion

2011-09-20 Thread Torsten Curdt
Before I was following the docs and wrote the bindings clue code myself http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CocoaBindings/Concepts/HowDoBindingsWork.html#//apple_ref/doc/uid/20002373 - (void)bind:(NSString *)binding toObject:(id)theObservedObject

How to replace occurrences of a pattern with a NSAttributedString

2011-09-20 Thread Sandeep Mohan Bhandarkar
Hi All, Can anyone tell me how the following can be achieved. I have a string as given bellow. This is a simple text with an attachment ATTACHMENT I would like to replace the occurrence of the pattern ATTACHMENT with a NSAttributedString (Containing a icon). Can some one please let me know

Re: How to replace occurrences of a pattern with a NSAttributedString

2011-09-20 Thread Mike Abdullah
On 20 Sep 2011, at 10:16, Sandeep Mohan Bhandarkar wrote: Hi All, Can anyone tell me how the following can be achieved. I have a string as given bellow. This is a simple text with an attachment ATTACHMENT I would like to replace the occurrence of the pattern ATTACHMENT with a

Re: Find panel problems

2011-09-20 Thread Mike Abdullah
On 20 Sep 2011, at 08:54, jonat...@mugginsoft.com wrote: On 20 Sep 2011, at 02:12, Ryan Joseph wrote: Maybe I'm not understanding how the system works (where are the find panel docs anyways?) but I simply have an NSTextView with setUsesFindPanel enabled and when I open the find panel

Re: How to replace occurrences of a pattern with a NSAttributedString

2011-09-20 Thread Sandeep Mohan Bhandarkar
Hi Mike, ATTACHMENT is a character sequence.. Thanks, Sandeep On Sep 20, 2011, at 2:26 AM, Mike Abdullah wrote: On 20 Sep 2011, at 10:16, Sandeep Mohan Bhandarkar wrote: Hi All, Can anyone tell me how the following can be achieved. I have a string as given bellow. This is a

Duplicating an edited document in 10.7.1

2011-09-20 Thread Gerriet M. Denkmann
In my toy editor I open an existing document, modify it and click Duplicate. A Sheet comes down and tells me that the duplicate will contain my latest modifications. I click the default Duplicate button and get: 2011-09-20 16:29:43.164 TextEditor[4062:707] *** -[NSPathStore2

NSDocument - based application and --Edited string in window title

2011-09-20 Thread Nick
Hello Is there a way to get rid of this substring when the opened document is changed? I would like to preserve the changes made until the user presses Command+S (or saves the file explicitly), so saving the document every time the user types some text is not an option (however, it vanishes the

Re: Sandboxing and file references

2011-09-20 Thread Tim Schröder
I don't think that the access rights are permanent, the only way to enable sandboxing for this kind of app would be to use a temporary exception entitlement giving your app access to the whole file system (not sure if Apple will like that for the Mac App Store, though). You can copy your

Re: Sandboxing and file references

2011-09-20 Thread Torsten Curdt
I don't think that the access rights are permanent, the only way to enable sandboxing for this kind of app would be to use a temporary exception entitlement giving your app access to the whole file system (not sure if Apple will like that for the Mac App Store, though). That would suck

Re: NSDocument - based application and --Edited string in window title

2011-09-20 Thread Mike Abdullah
Sounds to me like you probably want to opt out of the new autosave-in-place behaviour. On 20 Sep 2011, at 10:55, Nick wrote: Hello Is there a way to get rid of this substring when the opened document is changed? I would like to preserve the changes made until the user presses Command+S (or

Re: Duplicating an edited document in 10.7.1

2011-09-20 Thread Mike Abdullah
On 20 Sep 2011, at 10:49, Gerriet M. Denkmann wrote: In my toy editor I open an existing document, modify it and click Duplicate. A Sheet comes down and tells me that the duplicate will contain my latest modifications. I click the default Duplicate button and get: 2011-09-20

Re: NSDocument - based application and --Edited string in window title

2011-09-20 Thread Nick
Not the behavior, i want only to get rid of that -- Edited string in window's title, when the opened file is modified but not yet saved 2011/9/20 Mike Abdullah cocoa...@mikeabdullah.net Sounds to me like you probably want to opt out of the new autosave-in-place behaviour. On 20 Sep 2011, at

Re: How to replace occurrences of a pattern with a NSAttributedString

2011-09-20 Thread Mike Abdullah
To find the range of the attachment, something like this: NSRange range = [[myAttributedString string] rangeOfString:@ATTACHMENT]; Then sub in your your replacement: [myAttributedString replaceCharactersInRange:range withAttributedString:myIconAttributedString]; On 20 Sep 2011, at 10:30,

Re: Duplicating an edited document in 10.7.1

2011-09-20 Thread Gerriet M. Denkmann
On 20 Sep 2011, at 19:51, Mike Abdullah wrote: On 20 Sep 2011, at 10:49, Gerriet M. Denkmann wrote: In my toy editor I open an existing document, modify it and click Duplicate. A Sheet comes down and tells me that the duplicate will contain my latest modifications. I click the

Re: Sandboxing and file references

2011-09-20 Thread Kyle Sluder
On Sep 19, 2011, at 9:26 PM, Peter N Lewis pe...@stairways.com.au wrote: Questions: * When the user opens/drags a file to me application, is the explicit entitlement to read that file that I'm granted permanent? Will it remain across launch/reboots? Nope. This is a known limitation.

Re: NSDocument - based application and --Edited string in window title

2011-09-20 Thread Kyle Sluder
On Sep 20, 2011, at 6:08 AM, Nick eveningn...@gmail.com wrote: Not the behavior, i want only to get rid of that -- Edited string in window's title, when the opened file is modified but not yet saved Why? If it's part of the standard UI, the user is going to expect it there. Do other apps not

Re: Duplicating an edited document in 10.7.1

2011-09-20 Thread Kevin Perry
There's a bug in NSDocument in that it doesn't protect itself against nil return values from -fileNameExtensionForType:saveOperation:. To work around, make sure you return a non-nil value from that method. -KP On Sep 20, 2011, at 2:49 AM, Gerriet M. Denkmann wrote: In my toy editor I open an

Re: Sandboxing and file references

2011-09-20 Thread Keith Duncan
On 20 Sep 2011, at 11:30, Torsten Curdt wrote: I don't think that the access rights are permanent, the only way to enable sandboxing for this kind of app would be to use a temporary exception entitlement giving your app access to the whole file system (not sure if Apple will like that for

Re: NSDocument - based application and --Edited string in window title

2011-09-20 Thread Nick
there must be some way to override this default title suffix. I was able to override the title string itself (i.e, now instead of the filename or untitled i get there my application's name), but --edited is automatically appended there anyway whenever an existing document is opened and changed

Re: NSArrayController and NSTableView

2011-09-20 Thread R
I sounded confused because I was I think I've sorted it out. Thanks On Sep 19, 6:19 pm, Keary Suska cocoa-...@esoteritech.com wrote: On Sep 19, 2011, at 6:00 PM, R wrote: I find that in order for my NSTableView to update when bound to an NSArrayController, I have to add objects to the

Re: Duplicating an edited document in 10.7.1

2011-09-20 Thread Gerriet M. Denkmann
On 20 Sep 2011, at 22:40, Kevin Perry wrote: There's a bug in NSDocument in that it doesn't protect itself against nil return values from -fileNameExtensionForType:saveOperation:. To work around, make sure you return a non-nil value from that method. Thank you very much! Now everything

Re: bindings confusion

2011-09-20 Thread Lee Ann Rucker
Define doesn't work - if you mean observeValue:forKeyPath:... doesn't get called, it's because that's a different relationship from bindings. With bindings, a change in one value causes a change in another. With observers, a change in one value causes a call to the observeValue method. On

Re: bindings confusion

2011-09-20 Thread Quincey Morris
On Sep 20, 2011, at 02:13 , Torsten Curdt wrote: Before I was following the docs and wrote the bindings clue code myself http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CocoaBindings/Concepts/HowDoBindingsWork.html#//apple_ref/doc/uid/20002373 -

Re: NSDocument - based application and --Edited string in window title

2011-09-20 Thread Kyle Sluder
On Tue, Sep 20, 2011 at 9:06 AM, Nick eveningn...@gmail.com wrote: there must be some way to override this default title suffix. Must is not a synonym for I want there to be. I need this because of the specificity of the application and because customer wants that badly. I'm aware that it's

Re: Sandboxing and file references

2011-09-20 Thread Jerry Krinock
On 2011 Sep 20, at 08:48, Keith Duncan wrote: Any URLs an application encodes into it's restorable state archive (resume support is required for any open windows for automatic termination to actually quit an application) will be accessible in terms of sandboxing when the application is

Re: NSDocument - based application and --Edited string in window title

2011-09-20 Thread Nick
thanks Kyle, that helped 2011/9/20 Kyle Sluder kyle.slu...@gmail.com On Tue, Sep 20, 2011 at 9:06 AM, Nick eveningn...@gmail.com wrote: there must be some way to override this default title suffix. Must is not a synonym for I want there to be. I need this because of the specificity of

Sandboxed app, PDEs and preferences

2011-09-20 Thread Gerd Knops
Hi All, I have a printer driver with a Cocoa PDE that has some options. I'd like to have these options change for all apps when the user modifies them in one (stuff like account name to access the printer, remember password etc. The password itself is stored in the keychain). For that to work

Re: Sandboxing and file references

2011-09-20 Thread Keith Duncan
On 20 Sep 2011, at 19:35, Jerry Krinock wrote: At first I was thinking that this would give my app a permanent entitlement to whatever URL was selected. But what if the user restarts and clicks Don't restore windows. Wouldn't that break it? Based on what I have been told and my own

Telling apart different save panels

2011-09-20 Thread Graham Cox
In my app I have two places where a NSSavePanel is used to set up different sorts of file save. Using the modern 'block completion' approach, running the panels as sheets, the code is very nice, self-contained and clean. The save panel variable is a local var in the method that kicks off the

Re: Telling apart different save panels

2011-09-20 Thread Scott Ribe
On Sep 20, 2011, at 4:15 PM, Graham Cox wrote: In my app I have two places where a NSSavePanel is used to set up different sorts of file save. I think I'd use two different completion blocks... -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice

Re: Telling apart different save panels

2011-09-20 Thread Graham Cox
On 21/09/2011, at 8:27 AM, Scott Ribe wrote: I think I'd use two different completion blocks... I am already. It doesn't solve the problem. It's not the completion blocks that need to distinguish the panels (well, they do, and they do…), it's the panel's delegate. --Graham

Re: Telling apart different save panels

2011-09-20 Thread Kyle Sluder
On Tue, Sep 20, 2011 at 3:15 PM, Graham Cox graham@bigpond.com wrote: I could of course assign the save panels to an ivar of the delegate so that it can perform a comparison, but that strikes me as pretty messy, given that otherwise the panels are very neatly encapsulated along with their

Re: Telling apart different save panels

2011-09-20 Thread Graham Cox
OK, I've done it this way and it seems to be quite a nice solution - thanks! In terms of memory management, I'm releasing the helper object (panel delegate) in the completion block. While that apparently works without a problem, I'm wondering if that's truly safe and reliable - I'm still fairly

Re: Telling apart different save panels

2011-09-20 Thread Andy Lee
I guess I didn't understand the original problem. I thought the id of the save panel wasn't useful because it's local variable. It sounded like it's not so much the save panel you want to distinguish, but the context in which the save panel is being used. I was going to suggest making

FSCopyObjectAsync() under ARC

2011-09-20 Thread Indragie Karunaratne
I'm trying to use FSCopyObjectAsync() to copy a file and get progress callbacks to update my UI. The last parameter (clientContext) gets passed on to the callback. Under ARC, I can not pass self because the parameter has a void* type. Using (__bridge void*)self silences the compiler warning but

Re: FSCopyObjectAsync() under ARC

2011-09-20 Thread David Duncan
On Sep 20, 2011, at 5:07 PM, Indragie Karunaratne wrote: I'm trying to use FSCopyObjectAsync() to copy a file and get progress callbacks to update my UI. The last parameter (clientContext) gets passed on to the callback. Under ARC, I can not pass self because the parameter has a void*

Re: FSCopyObjectAsync() under ARC

2011-09-20 Thread Indragie Karunaratne
This one was a case of not reading the docs properly :-) The clientContext parameter was supposed to be an FSFileOperationClientContext struct with the 'info' member set to the data/object. The EXC_BAD_ACCESS was caused by me trying to pass in 'self' instead of the struct. On 2011-09-20, at

Re: Find panel problems

2011-09-20 Thread Ryan Joseph
I think the problem was my window was not the main window (setting it just as key didn't help), which I should have known if I was using Cocoa longer. Hopefully other users would assume this. :) Thanks for your time! On Sep 20, 2011, at 2:54 PM, jonat...@mugginsoft.com wrote: IIRC the

Re: Telling apart different save panels

2011-09-20 Thread douglas welton
Graham, I'm not sure that my solution is any less messy than what you have suggested, but... when faced with this same situation, I gave the save panel a different title each time it was invoked. When the panel object was passed to my delegate, I could tell where the panel was being used by

Re: Telling apart different save panels

2011-09-20 Thread Scott Ribe
On Sep 20, 2011, at 4:43 PM, Graham Cox wrote: I am already. It doesn't solve the problem. It's not the completion blocks that need to distinguish the panels (well, they do, and they do…), it's the panel's delegate. Ah, I was thinking that the completion blocks were calling into the

Re: Telling apart different save panels

2011-09-20 Thread Graham Cox
On 21/09/2011, at 8:54 AM, Scott Ribe wrote: Ah, I was thinking that the completion blocks were calling into the delegate, and that you needed to distinguish between panels there. So you're trying to distinguish earlier? Yes, specifically, in the delegate method: panel:validateURL:error:

tableView blue selection highlight...

2011-09-20 Thread R
Looking inside Address Book, when you select a name from the name column, the box (tableView) does not highlight in blue. Is there a way to duplicate this behavior in NSTableview. removing the blue highlight trim around the table? ___ Cocoa-dev

Re: tableView blue selection highlight...

2011-09-20 Thread Indragie Karunaratne
It's called a focus ring. You can set Focus Ring to None in Interface Builder or configure it programatically: [view setFocusRingType:NSFocusRingTypeNone]; On 2011-09-20, at 10:18 PM, R wrote: Looking inside Address Book, when you select a name from the name column, the box (tableView) does

Re: Sandboxing and file references

2011-09-20 Thread Peter N Lewis
Thanks for the various answers, here is a summary: The explicit entitlement to read a file following an open/drag exists only until the application quits (a fragile exception exists in using URLs stored into the restorable state archive, but even that won't work long term). Thus keeping