Re: Docs by Contradiction: -isDocumentEdited vs. -updateChangeCount:
On 2010 Jan 18, at 09:14, Jerry Krinock wrote: > - (BOOL)isDocumentEdited > { >return (_changeCount > 0) ; > } > > Am I correct? No, I was wrong. After getting the ivar offset from otool, I poked around with gdb and found that _changeCount can actually be negative. This occurs if you do several edits, save the document, then start Undoing. Exactly as specified by -updateChangeCount documentation, the _changeCount decrements, to -1, -2, etc. The behavior does seem to be - (BOOL)isDocumentEdited { return (_changeCount != 0) ; } I also confirmed another undocumented fact that I suspected, which is that sending -updateChangeCount:NSChangeRedone causes changeCount to increment. ___ 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: Moderated post on self going out of scope
On Jan 18, 2010, at 9:50 PM, David Blanton wrote: > So I set stack-protector-all as "other C++ flags" and got _stack_chk_fail > > > So this means the C++ constructor is corupting the stack? Sounds like it. I think the backtrace should indicate where the corruption was detected. Is the C++ class implementation in a library? Does it have different compiler options set than the Objective-C++ file that's using it? If one module thinks the C++ class takes N bytes (on the stack in this case) and the module with the constructor thinks it takes M bytes, then you can get a result like you're seeing. The constructor code, compiled under one set of assumptions, stores data as appropriate for those assumptions. The client code, compiled under a different set of assumptions, may not set aside the number of bytes required by the constructor's behavior. Of course, it may just be a garden variety programmer logic error. Have you got all warnings enabled? Are you addressing all the warnings the compiler reports? You could also show the class declaration, the constructor definition, and the method that's instantiating an instance of the class (and getting its stack smashed). Regards, Ken ___ 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: Moderated post on self going out of scope
So I set stack-protector-all as "other C++ flags" and got _stack_chk_fail So this means the C++ constructor is corupting the stack? -db On Jan 18, 2010, at 8:28 PM, Ken Thomases wrote: On Jan 18, 2010, at 9:17 PM, David Blanton wrote: In a view IBAction I instance a C++ class. As soon as the class is instanced, self in the variables window, goes to 0x0 ! Try logging the value of self, rather than relying on the debugger display. The debugger can sometimes be wrong. Otherwise, make sure the constructor of your C++ class isn't trashing memory. Sounds like writing past the bounds of a stack variable. If you're doing placement new, you might also be messing that up. You could try compiling with -fstack-protector-all to try to detect stack smashers closer to where/when they happen. Regards, Ken ___ 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: Moderated post on self going out of scope
Oh I forgot to do -fstack-protector-all where do I set that? On Jan 18, 2010, at 8:28 PM, Ken Thomases wrote: On Jan 18, 2010, at 9:17 PM, David Blanton wrote: In a view IBAction I instance a C++ class. As soon as the class is instanced, self in the variables window, goes to 0x0 ! Try logging the value of self, rather than relying on the debugger display. The debugger can sometimes be wrong. Otherwise, make sure the constructor of your C++ class isn't trashing memory. Sounds like writing past the bounds of a stack variable. If you're doing placement new, you might also be messing that up. You could try compiling with -fstack-protector-all to try to detect stack smashers closer to where/when they happen. Regards, Ken ___ 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: Moderated post on self going out of scope
Ok. The C++ constructor does nothing more than assign a member variable by calling a function. And, the NSLog of self breaks as well! Hmmm ! On Jan 18, 2010, at 8:32 PM, David Blanton wrote: Good tips Ken ... I am on it! On Jan 18, 2010, at 8:28 PM, Ken Thomases wrote: On Jan 18, 2010, at 9:17 PM, David Blanton wrote: In a view IBAction I instance a C++ class. As soon as the class is instanced, self in the variables window, goes to 0x0 ! Try logging the value of self, rather than relying on the debugger display. The debugger can sometimes be wrong. Otherwise, make sure the constructor of your C++ class isn't trashing memory. Sounds like writing past the bounds of a stack variable. If you're doing placement new, you might also be messing that up. You could try compiling with -fstack-protector-all to try to detect stack smashers closer to where/when they happen. Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/airedale%40tularosa.net This email sent to aired...@tularosa.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Moderated post on self going out of scope
Good tips Ken ... I am on it! On Jan 18, 2010, at 8:28 PM, Ken Thomases wrote: On Jan 18, 2010, at 9:17 PM, David Blanton wrote: In a view IBAction I instance a C++ class. As soon as the class is instanced, self in the variables window, goes to 0x0 ! Try logging the value of self, rather than relying on the debugger display. The debugger can sometimes be wrong. Otherwise, make sure the constructor of your C++ class isn't trashing memory. Sounds like writing past the bounds of a stack variable. If you're doing placement new, you might also be messing that up. You could try compiling with -fstack-protector-all to try to detect stack smashers closer to where/when they happen. Regards, Ken ___ 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: Moderated post on self going out of scope
On Jan 18, 2010, at 9:17 PM, David Blanton wrote: > In a view IBAction I instance a C++ class. As soon as the class is instanced, > self in the variables window, goes to 0x0 ! Try logging the value of self, rather than relying on the debugger display. The debugger can sometimes be wrong. Otherwise, make sure the constructor of your C++ class isn't trashing memory. Sounds like writing past the bounds of a stack variable. If you're doing placement new, you might also be messing that up. You could try compiling with -fstack-protector-all to try to detect stack smashers closer to where/when they happen. Regards, Ken ___ 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
Moderated post on self going out of scope
I posted this with two images from the debugger but it is awaiting moderator screening. In a view IBAction I instance a C++ class. As soon as the class is instanced, self in the variables window, goes to 0x0 ! This worked fine until I embedded the view win a split view! Now moving the instantiation of the C++ class to the interface it works again! This seems to be a bug. Comments please, I have a long night ahead! ___ 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
Cocoa equivalent to HIViewGetOptimalBounds?
Hi, Is there a Cocoa equivalent to HIViewGetOptimalBounds()? That function would return the optimal bounds for an HIView and I found it very useful. I need to support 10.4. Regards, Jo Meder___ 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: Make sheets open instantly
On Jan 18, 2010, at 7:19 PM, Chris Hanson wrote: > On Jan 18, 2010, at 2:43 PM, David Catmull wrote: > >> Is there any way to make sheets open instantly, instead of animating? I'd >> just like to speed up my unit tests. > > Why do your unit tests need to bring up sheets? Can't speak for the OP, but it may be for "acceptance" tests. I have two types of tests myself; units and acceptance. The latter are scenario-based and hit the UI to perform a scenario just as a user would. I also had to add a flag to my iPhone OS code so that all animations occurred instantly for the sake of keeping test runs short. ___ Ricky A. Sharp mailto:rsh...@instantinteractive.com Instant Interactive(tm) http://www.instantinteractive.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: Blocking for input during a loop?
Thank you all for the replies! :) Anyway, you've clearly misunderstood. I have clearly not explained properly what I wanted to do, sorry about that. Probably because I'm not quite into the lingo. I've found a great solution, but in case anyone has a technical interest I'll try to explain it better... Jens Alfke wrote: > On Jan 18, 2010, at 3:38 AM, Per Bull Holmen wrote: > > You say my initially > > proposed loop is a bad idea - but lots of applications use this type of > > loop. The difference is that they do it only inside one window, and > > block user access to all other parts of the application (modal windows). > > They do this for wizards and the like, which are far closer to how the > > game will eventually be than a "regular" application. > > That's not really true. A modal dialog is still running the runloop, > it's just a nested runloop. So at the outer level it looks like the app > has blocked in order to run the modal dialog, what's actually happening > is that the runloop is still in charge and handling events as usual, > it's just ignoring mouse clicks outside that window. When the runloop is > finished with the modal window it returns control back to the original > code. I was not talking about not running the runloop (on the contrary), I was speaking strictly on code level: Write a piece of code that blocks execution and waits for user input, just like I wrote, as opposed to the typical MVC/event driven way, which is marvellous for document based apps and in fact almost all applications, but isn't perfect for every use (even Apple concedes that). Games with intricate branched game logics is one great example. Whether the runtime system runs a runloop, and handles events such as the "quit" command was not part of my question. What I meant was writing code something like this: 1) Do something 2) Block/wait for the user to respond to, say, a question etc... (without having to terminate the function/method and have to store a lot of intermediate variables) 3) Do something with the input. Whether this happens inside a loop was really besides the point. Whether NSRunLoop runs etc... irrelevant. And YES, with a modal dialog you not only CAN do this, it's also often done, and I've done it lots of times. NSRunAlertPanel and NSOpenPanel are two, very simple examples. (that is, when you call it, the calling code is blocked untill the modal session is over). The only problem with the modal way, in this case, is that it only accepts input from one single window. > What you're talking about is an inverted flow of control where your code > is in charge and periodically calls the runloop to handle an event. It's > possible to write code that way, but it gets really messy in the real > world because you're privileging one possible flow of control while > ignoring the others. So you may be waiting for the user to press button > A or button B, but what happens if the user decides to choose the Quit > command? Now your loop has to handle that too. What you'll end up with > is an explosion of different cases in your event-handling code, which > gets just as messy as the normal flow of control would have been, only > worse because all the complexity is in one big switch statement. Again, I have clearly not explained what I wanted to do properly. No, I did not want what you describe. I have done it now, I chose to use threads, and it got far cleaner than the "standard Cocoa way". No, I don't have to handle any other input than what's relevant for the game, Cocoa handles the rest, thank you... :) The thing is that the way Cocoa usually handles things is really great for the vast majority of apps, but in an interactive game with an intricate, branched flow of game logic, you'll sometimes want to write the game logic in more coherent pieces of code that focus on logic/control flow, rather than updating a lot of intermediate state variables. It just gets cleaner, more maintainable, and more extensible this way. I was able to do this great within the Cocoa system, I just had to write a simple, sort of a mediating layer between the game controller (which runs in a separate thread) and the main UI thread. I really appreciate your replies! I must have explained it poorly... anyway if someone still want to convince me I'm doing things the wrong way, then I'm guessing either they are so in love with MVC they have lost their sense of reality, or they still haven't understood what I'm trying to explain... :) Per ___ 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: Problem with changes to NSArrayControllers array causing crash
On 19/01/2010, at 12:19 PM, Grant Christensen wrote: > > On 19/01/2010, at 11:28 AM, Corbin Dunn wrote: > >>> ... >>> 20 VATSpy 0x00014912 -[BBSDataMgr >>> loadDataFile:] + 3851 >>> 21 Foundation 0x7fff8166de99 >>> __NSThread__main__ + 1429 >>> 22 libSystem.B.dylib 0x7fff814c2f8e >>> _pthread_start + 331 >>> 23 libSystem.B.dylib 0x7fff814c2e41 thread_start >>> + 13 >>> ) >>> Code is: >>> [myTableView reloadData]; >>> } >> >> NSTableView is not threadsafe - do not call reloadData on a background >> thread. However, given your particular case it is probably the >> arraycontroller change that is causing the mutation. >> >> corbin >> >> >> > > Actually thinking through the flow, it is currently my background thread that > is calling the reload. I have commented that out and it is still crashing, > but it is probably a thread safety issue. I will re-structure so that the > background thread signals the main thread its work is done rather than call > back into it, which is what it was doing. Will see how that goes... > Yep, chalk another one up to thread safety. I was kicking off the worker thread to go away and collect all of the data. When done, it was invoking a selector on the main thread to notify of completion. I was using : [callbackMethod performSelector: @selector(loadComplete:) withObject:[NSNumber numberWithBool:returnResult]]; instead of the thread safe version: [callbackMethod performSelectorOnMainThread:@selector(loadComplete:) withObject:[NSNumber numberWithBool:returnResult] waitUntilDone:NO]; This seems to have fixed it. Thanks Corbin for pointing me towards the threading issues! Grant___ 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: Problem with changes to NSArrayControllers array causing crash
On 19/01/2010, at 11:28 AM, Corbin Dunn wrote: >> ... >> 20 VATSpy 0x00014912 -[BBSDataMgr >> loadDataFile:] + 3851 >> 21 Foundation 0x7fff8166de99 >> __NSThread__main__ + 1429 >> 22 libSystem.B.dylib 0x7fff814c2f8e >> _pthread_start + 331 >> 23 libSystem.B.dylib 0x7fff814c2e41 thread_start >> + 13 >> ) >> Code is: >> [myTableView reloadData]; >> } > > NSTableView is not threadsafe - do not call reloadData on a background > thread. However, given your particular case it is probably the > arraycontroller change that is causing the mutation. > > corbin > > > Actually thinking through the flow, it is currently my background thread that is calling the reload. I have commented that out and it is still crashing, but it is probably a thread safety issue. I will re-structure so that the background thread signals the main thread its work is done rather than call back into it, which is what it was doing. Will see how that goes... --- Grant Christensen ___ 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: Problem with changes to NSArrayControllers array causing crash
> ... > 20 VATSpy 0x00014912 -[BBSDataMgr > loadDataFile:] + 3851 > 21 Foundation 0x7fff8166de99 > __NSThread__main__ + 1429 > 22 libSystem.B.dylib 0x7fff814c2f8e > _pthread_start + 331 > 23 libSystem.B.dylib 0x7fff814c2e41 thread_start > + 13 > ) > Code is: > [myTableView reloadData]; > } NSTableView is not threadsafe - do not call reloadData on a background thread. However, given your particular case it is probably the arraycontroller change that is causing the mutation. 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
Re: Unembed Objects
On Jan 18, 2010, at 3:50 PM, David Blanton wrote: > I have embeded two views in a split view then embeded that result with > another view in a split view to get a resulting vert splitter and horz > splitter. > > Now I would like to Uembed an cannot no matter what selections I do get > Uembed to enable in the IB Layout Menu. First, some background. Depending on your window layout, sometimes unembed is disabled because the parent view wouldn't support the new child views. For example, if you started with two views, and embedded them into a split view, and then embedded that split view into a scroll view, and the selected the split view and tried to "Unembed objects", it would be disabled. It would be disabled because unpacking the split view would result in trying to put two sub views into the scroll view as the scroll view's content view, and the scroll view can only have one content view. > Any suggestions ? Please . I would use the document outline view, and drag and drop all of the views to their new destinations. This will give you precise and direct control over the hierarchy of your document. Good Luck - Jon Hess > > -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/jhess%40apple.com > > This email sent to jh...@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: Make sheets open instantly
On Jan 18, 2010, at 2:43 PM, David Catmull wrote: > Is there any way to make sheets open instantly, instead of animating? I'd > just like to speed up my unit tests. Why do your unit tests need to bring up sheets? — Chris ___ 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: Make sheets open instantly
On Jan 18, 2010, at 2:43 PM, David Catmull wrote: > Is there any way to make sheets open instantly, instead of animating? I'd > just like to speed up my unit tests. Hi David, If you run the following before launching your app, you'll get speedy sheets. defaults write NSGlobalDomain NSWindowResizeTime .001 Return to normal with defaults delete NSGlobalDomain NSWindowResizeTime Warren ___ 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
Unembed Objects
I have embeded two views in a split view then embeded that result with another view in a split view to get a resulting vert splitter and horz splitter. Now I would like to Uembed an cannot no matter what selections I do get Uembed to enable in the IB Layout Menu. Any suggestions ? Please . -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: Make sheets open instantly
Pretty certain there's a user default you can set to determine the length of window animations. It might apply to sheets too? Have a hunt around the NSWindow reference. On 18 Jan 2010, at 22:43, David Catmull wrote: > Is there any way to make sheets open instantly, instead of animating? I'd > just like to speed up my unit tests. > > -- > David Catmull > uncom...@uncommonplace.com > http://www.uncommonplace.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/cocoadev%40mikeabdullah.net > > This email sent to cocoa...@mikeabdullah.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: [iphone] Release Navigation View Controller Question
Am 18.01.2010 um 14:40 schrieb Philip Vallone: > Hi this is a follow up question on memory management. In my class > BrowseViewController, I have a UITableView and 2 NSMutableArrays. > > @interface BrowseViewController : UIViewController { > IBOutlet UITableView *tableView; > NSMutableArray *tableList; > NSMutableArray *cfrTitleList; > } > @property(nonatomic, retain) UITableView *tableView; > > @end > > Now the BrowseViewController has a few "child" Navigational controllers. This > allows the user to drill down. My question is, in the BrowseViewController.m > dealloc method, if I release the two NSMutableArrays, I receive the error > “EXC_BAD_ACCESS”. Then you forgot to retain them when you should. Show code where they are assigned if you can’t fix it. > If I don't release the NSMutableArrays, does this mean the > navigationController takes ownership of the NSMutableArrays? No, it does not even know they exist. How should it? atze ___ 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
Problem with changes to NSArrayControllers array causing crash
Hi all, I have problem with a NSTableView bound to an NSArrayController bound to an NSMutableArray in my controller class. After the following sequence I get a crash: 1) start application 2) request download of data 3) populate data into mutable array 4) show the view 5) ask for another download 6) removeobjects from the array 7)add new objects to array I get the following crash on the remove: 2010-01-18 23:59:44.614 xxx[8944:5537] An uncaught exception was raised 2010-01-18 23:59:44.615 xxx[8944:5537] *** Collection was mutated while being enumerated.NSHashTable (%@) { } ' *** Call stack at first throw: ( 0 CoreFoundation 0x7fff85b48444 __exceptionPreprocess + 180 1 libobjc.A.dylib 0x7fff849cf0f3 objc_exception_throw + 45 2 CoreFoundation 0x7fff85b9f66f __NSFastEnumerationMutationHandler + 303 3 Foundation 0x7fff81684839 -[NSConcreteHashTable countByEnumeratingWithState:objects:count:] + 78 4 AppKit 0x7fff832891fb -[_NSModelObservingTracker clearAllModelObjectObserving] + 308 5 AppKit 0x7fff83363c2f -[_NSModelObservingTracker setIndexReferenceModelObjectArray:clearAllModelObjectObserving:] + 42 6 AppKit 0x7fff834043c0 -[NSTableBinder _updateContent] + 89 7 AppKit 0x7fff83404280 -[NSTableBinder _observeValueForKeyPath:ofObject:context:] + 91 8 AppKit 0x7fff83404093 -[NSTableBinder observeValueForKeyPath:ofObject:change:context:] + 68 9 Foundation 0x7fff8168718d -[NSObject(NSKeyValueObservingPrivate) _notifyObserversForKeyPath:change:] + 991 10 AppKit 0x7fff83286132 -[NSController _notifyObserversForKeyPath:change:] + 218 11 AppKit 0x7fff8338fceb -[NSArrayController didChangeValuesForArrangedKeys:objectKeys:indexKeys:] + 63 12 AppKit 0x7fff8336417b -[NSArrayController setContent:] + 899 13 AppKit 0x7fff83402129 -[NSArrayDetailBinder _refreshDetailContentInBackground:] + 1301 14 Foundation 0x7fff81680d8e NSKeyValueDidChange + 458 15 Foundation 0x7fff817531b5 -[NSObject(NSKeyValueObserverNotification) didChange:valuesAtIndexes:forKey:] + 134 16 Foundation 0x7fff8174bbc9 -[NSKeyValueNotifyingMutableArray removeObjectAtIndex:] + 170 17 CoreFoundation 0x7fff85b54b2e -[NSMutableArray removeAllObjects] + 62 18 VATSpy 0x0001ed01 -[BBSControllersViewController loadValues] + 282 19 VATSpy 0x0001e12f -[BBSMainWindowController loadComplete:] + 695 20 VATSpy 0x00014912 -[BBSDataMgr loadDataFile:] + 3851 21 Foundation 0x7fff8166de99 __NSThread__main__ + 1429 22 libSystem.B.dylib 0x7fff814c2f8e _pthread_start + 331 23 libSystem.B.dylib 0x7fff814c2e41 thread_start + 13 ) Code is: BBSDataMgr *mgr = [BBSDataMgr sharedManager]; @try { if ([mgr clientControllers] != nil) { [[mgr updateLock] lock]; NSArray *arr = [[mgr clientControllers] allValues]; if ([controllers count] >0]) [[[self mutableArrayValueForKey:@"controllers"] removeAllObjects]; [[self mutableArrayValueForKey:@"controllers"] addObjectsFromArray:arr]; [myTableView reloadData]; } } @finally { [[mgr updateLock] unlock]; } Grant ___ 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: Bundle and window server interaction
On Jan 18, 2010, at 10:04 PM, jonat...@mugginsoft.com wrote: >> Or use TransformProcessType to elevate your Unix style executable to GUI >> status: [...] > Looking at rb-appscript [...] the process is transformed only when error > -1713 occurs. Correct, errAENoUserInteraction = -1713. > Ideally I would like to examine my AppleScript for the presence of syso/dlog > et al and transform it accordingly. > Searching has revealed that "a custom send proc" might be suitable. > Ignorance prevents me from proceeding further. > The goal is: > > if my script aeDesc contains eventid:{dlog, aleR, chcl, chlt, chra, chur, > disA, nwfl, ppcb, stdf, stfl) > transform_process_to_foreground_application procee > end if As you say, install a custom send proc into the AppleScript component. Personally, I would have it send the event and sniff for errAENoUserInteraction in the reply event, as third-party osaxen may run into the same problem and you can't reasonably check for every possible event code beforehand. If an errAENoUserInteraction is found, elevate the process then resend the event. (Since it's already been responded to, I think it'll be safe to reuse the original AppleEvent descriptor as-is without having to futz with obtaining a new return ID.) You can't install custom send procs via NSAppleScript. Can't recall offhand if OSAKit allows it, otherwise you'll need to get down and dirty with the crusty old Carbon OSA API. Which isn't all that hard, though OT for this list. Alternatively, you could just be a pedant and insist anyone running AppleScript targets dialog commands at System Events. This avoids the need to elevate your GUI-less process in the first place, which also has side-effects such as creating a menubar and Dock icon; that's what ASers do when using dialog commands from osascript. > We can switch this to applescript-implementors if required. I would suggest taking further emails there - quieter and better suited to the subject. Regards, has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.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
Make sheets open instantly
Is there any way to make sheets open instantly, instead of animating? I'd just like to speed up my unit tests. -- David Catmull uncom...@uncommonplace.com http://www.uncommonplace.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: CALayer with No Animation
On Jan 18, 2010, at 1:47 PM, Richard Somers wrote: > When I do this the OpenGL layer has no animations what so ever. So > in-other-words when I simply draw, using the standard draw method, there are > no animations. This is just a difference in the CAOpenGLLayer's implementation with respect to its contents. -- David Duncan Apple DTS Animation and Printing ___ 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: Use NSDocument as a variable of another NSDocument
Good points guys! In my application the table data depends on the movie it comes from. And also, there will be several tables for one movie (for example, one is for the video information and the other is about the audio information). The reason why I want to select the document architecture is because all the table data can be edited by the user, and finally, these data should be able to save onto the disk as text for further usage. Maybe a wrapped file for both the movie and the tables will be a better choice? In this way I think a NSDocument for the movie and then a list of table controllers will be better? Thanks! On Jan 18, 2010, at 1:59 PM, Jeffrey Oleander wrote: >> At Mon, 2010/01/18 15:19, Quincey Morris wrote: >> On 2010 Jan 18, at 10:48, Jarod Wen wrote: >>> Is it a proper design to use a NSDocument as a >>> variable of another NSDocument? >>> >>> I am now working on an application which generates >>> some information from a movie. The information >>> generated will be showed as a table, and the >>> information in the table can be saved/opened. >>> Multiple types of information are possible >>> so for one movie there may be several tables. >>> >>> I used the NSDocument architecture for the movie >>> document, and I am a little bit confused about >>> the hierarchy... > >> The question isn't whether one document object >> can contain a reference to another document >> object. The question is what's supposed to >> happen later when the derived (table) >> document is re-opened. >> >> If the table refers to information in the >> original (movie) document, you'll need to >> open the movie document too. > > That depends on what you mean by "refers to". > > I can refer to the Encyclopedia Brittanica > without opening it. I can say "this is > related to the movie 'Blah' whose screen- > play was written by Blurp, was direced > by Blorp, and produced by Bloop" without > having to open up that movie file. > > It just depends on what Jarod Wen wants > to do. > > If he wants the extracted data which he > displays in tables to be mostly independent > of the original movie, then he will need > that to be in a document with its own > hierarchy. The original movie would be > one document with its own data, > and the extracted data for that movie might > be a separate document with its own, > independent data hierarchy. If he does > that, then the 2 files can diverge, and > he might have to consider how to control > proliferation of related data files, > each derived from the same movie file. > > So, his question becomes, what object > owns each document type? What object > owns the movie? What object owns the > derived data that he displays as tables? > Or, should he just keep only the movie > document and extract/generate at run- > time the data to display in table views > as "views of the movie". > > > > ___ > > 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/jarodwen%40gmail.com > > This email sent to jarod...@gmail.com -- J.W. ___ 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: Bundle and window server interaction
On 18 Jan 2010, at 15:55, has wrote: > Dave Keck wrote: > >> That seems like a silly requirement for UI interaction... >> >> It seems you can get around it by making your app bundled and setting >> the LSUIElement key in your Info.plist, though. > > Or use TransformProcessType to elevate your Unix style executable to GUI > status: > > OSStatus err = 0; > ProcessSerialNumber psn = {0, kCurrentProcess}; > err = TransformProcessType(& psn, kProcessTransformToForegroundApplication); > > (This is what rb-appscript calls the first time a standard GUI-less ruby > process tries to display a Standard Additions dialog.) > Dave, Alastair, Has Thanks a lot. I was unaware of the existence of TransformProcessType(). Definitely moving in the right direction now. I agree that the bundle/windowserver connection is complicated by the presence of AppleScript. LSUIElement does the trick for a bundled app but in this case I would like to call TransformProcessType only if and when necessary. Has Looking at rb-appscript I can see: def method_missing(name, *args) begin super rescue Appscript::CommandError => e if e.to_i == -1713 # 'No user interaction allowed' error (e.g. user tried to send a 'display dialog' command to a non-GUI ruby process), so convert the target process to a full GUI process and try again AE.transform_process_to_foreground_application activate super else raise end end end So the process is transformed only when error -1713 occurs. Ideally I would like to examine my AppleScript for the presence of syso/dlog et al and transform it accordingly. Searching has revealed that "a custom send proc" might be suitable. Ignorance prevents me from proceeding further. The goal is: if my script aeDesc contains eventid:{dlog, aleR, chcl, chlt, chra, chur, disA, nwfl, ppcb, stdf, stfl) transform_process_to_foreground_application procee end if Sorry if we have departed a bit too far from Cocoa - we did start off there. We can switch this to applescript-implementors if required. Regards Jonathan Mitchell Developer http://www.mugginsoft.com > HTH > > has > -- > Control AppleScriptable applications from Python, Ruby and ObjC: > http://appscript.sourceforge.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: Use NSDocument as a variable of another NSDocument
> At Mon, 2010/01/18 15:19, Quincey Morris wrote: > On 2010 Jan 18, at 10:48, Jarod Wen wrote: >> Is it a proper design to use a NSDocument as a >> variable of another NSDocument? >> >> I am now working on an application which generates >> some information from a movie. The information >> generated will be showed as a table, and the >> information in the table can be saved/opened. >> Multiple types of information are possible >> so for one movie there may be several tables. >> >> I used the NSDocument architecture for the movie >> document, and I am a little bit confused about >> the hierarchy... > The question isn't whether one document object > can contain a reference to another document > object. The question is what's supposed to > happen later when the derived (table) > document is re-opened. > > If the table refers to information in the > original (movie) document, you'll need to > open the movie document too. That depends on what you mean by "refers to". I can refer to the Encyclopedia Brittanica without opening it. I can say "this is related to the movie 'Blah' whose screen- play was written by Blurp, was direced by Blorp, and produced by Bloop" without having to open up that movie file. It just depends on what Jarod Wen wants to do. If he wants the extracted data which he displays in tables to be mostly independent of the original movie, then he will need that to be in a document with its own hierarchy. The original movie would be one document with its own data, and the extracted data for that movie might be a separate document with its own, independent data hierarchy. If he does that, then the 2 files can diverge, and he might have to consider how to control proliferation of related data files, each derived from the same movie file. So, his question becomes, what object owns each document type? What object owns the movie? What object owns the derived data that he displays as tables? Or, should he just keep only the movie document and extract/generate at run- time the data to display in table views as "views of the movie". ___ 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: Bindings Problem
On Jan 18, 2010, at 11:01 AM, Jeffrey Oleander wrote: > http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Collections/Articles/Sets.html > > "Set Fundamentals: Note that if mutable objects are stored in a set, either > the hash method of the objects shouldn’t depend on the internal state of the > mutable objects or the mutable objects shouldn’t be modified while they’re in > the set (note that it can be difficult to know whether or not a given object > is in a collection)." > > So, you can use your own hash function to determine where in the set each > item is stored. In this case, each item stored in the set is an > NSMutableDictionary. And... you can't change the hash function used by NSMutableDictionary. So, for a custom class, you can implement a custom -hash method. But for NSMutableDictionary, you can't. And, if you do implement a custom -hash method for your custom class which is insensitive to the "contents" (whatever that might be) of its instances, then that's a _very_ different equality semantic than NSDictionary provides. > http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/Reference/Reference.html > > "Internally, a dictionary uses a hash table to organize its storage and to > provide rapid access to a value given the corresponding key. However, the > methods defined in this cluster insulate you from the complexities of working > with hash tables, hashing functions, or the hashed value of keys. The methods > described below take keys directly, not their hashed form." > > So, you may use your own hash function to create your keys... or not, as you > wish. Um, the keys are not typically the output of a hash function. Well, you can use such for keys, but that's irrelevant to the hash of the dictionary object, itself. > But then the NSDictionary and NSMutableDictionary will hash the keys you pass > to their methods using their own, internal, hash function, to determine where > objects are stored in the dictionary. Right. So, if you mutate the dictionary while it's in the set, you will break things. That's why a set of mutable dictionaries (as opposed to immutable dictionaries, or some other data structure entirely) raises a huge red flag. As I previously cited, from the documentation of -[NSObject hash]: http://developer.apple.com/mac/library/documentation/cocoa/Reference/Foundation/Protocols/NSObject_Protocol/Reference/NSObject.html "If a mutable object is added to a collection that uses hash values to determine the object’s position in the collection, the value returned by the hash method of the object must not change while the object is in the collection. Therefore, either the hash method must not rely on any of the object’s internal state information or you must make sure the object’s internal state information does not change while the object is in the collection. Thus, for example, a mutable dictionary can be put in a hash table but you must not change it while it is in there. (Note that it can be difficult to know whether or not a given object is in a collection.)" Note that this case of mutable dictionaries in a collection is explicitly warned about. > But my primary point was to ask the original poster to think about why he is > using this arrangement of instances of NSMutableDictionary stored in an > NSMutableSet. Yes, and that was my point, too. -Ken ___ 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: Blocking for input during a loop?
On Jan 18, 2010, at 3:38 AM, Per Bull Holmen wrote: > You say my initially proposed loop is a bad idea - but lots of applications > use this type of loop. The difference is that they do it only inside one > window, and block user access to all other parts of the application (modal > windows). They do this for wizards and the like, which are far closer to how > the game will eventually be than a "regular" application. That's not really true. A modal dialog is still running the runloop, it's just a nested runloop. So at the outer level it looks like the app has blocked in order to run the modal dialog, what's actually happening is that the runloop is still in charge and handling events as usual, it's just ignoring mouse clicks outside that window. When the runloop is finished with the modal window it returns control back to the original code. What you're talking about is an inverted flow of control where your code is in charge and periodically calls the runloop to handle an event. It's possible to write code that way, but it gets really messy in the real world because you're privileging one possible flow of control while ignoring the others. So you may be waiting for the user to press button A or button B, but what happens if the user decides to choose the Quit command? Now your loop has to handle that too. What you'll end up with is an explosion of different cases in your event-handling code, which gets just as messy as the normal flow of control would have been, only worse because all the complexity is in one big switch statement. By contrast, if you've got a cleanly-factored model, you'll be able to keep track of the state cleanly. The model object(s) will have the state, and the controller code will call the model to change from one state to another. —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: CALayer with No Animation
On Jan 18, 2010, at 1:10 PM, David Duncan wrote: I'm not certain what you mean by this. All layers participate in implicit animations, although each layer type can specify which keys are implicitly animated (and this can be further customized by developers). If you are saying that CAOpenGLLayer has a different set of default implicit animations, thats entirely possible, but they both should use the same mechanism. I have been implementing my CAOpenGLLayer subclass using the standard draw method. - (void)drawInCGLContext:(CGLContextObj)context pixelFormat:(CGLPixelFormatObj)format forLayerTime:(CFTimeInterval)interval displayTime:(const CVTimeStamp *)timeStamp { // Do some OpenGL drawing ... } When I do this the OpenGL layer has no animations what so ever. So in- other-words when I simply draw, using the standard draw method, there are no animations. To get the same effect with CALayer I need to override -actionForKey:. Thats what I meant by CALayer having automatic animation and CAOpenGLLayer having manual animation. --Richard ___ 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: Keeping closed windows in the Window menu
On Jan 18, 2010, at 13:18, Andreas Eriksson wrote: > Why is it necessary to delay the orderOutMyWindow invocation > with performSelector? I actually don't remember. Maybe it's not necessary, so by all means try it without the delay. ___ 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: Keeping closed windows in the Window menu
On Mon, Jan 18, 2010 at 10:04 PM, Quincey Morris wrote: > On Jan 18, 2010, at 11:23, Andreas Eriksson wrote: > >> What's the recommended way of keeping a window in the Window menu >> (like e.g. Address book and iChat does) so that it can be brought back >> even after it has been closed? > > Here's the code (in the window controller) I use to do this: > > - (void) orderOutMyWindow: (id) sender { > NSString* title = self.window.title; > [self.window orderOut: sender]; > [NSApp addWindowsItem: self.window title: title filename: NO]; > } > > - (BOOL) windowShouldClose: (id) sender { > [self performSelector: @selector (orderOutMyWindow:) withObject: > sender afterDelay: 0.0]; > return NO; > } Thanks! Why is it necessary to delay the orderOutMyWindow invocation with performSelector? ___ 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: Use NSDocument as a variable of another NSDocument
On Jan 18, 2010, at 10:48, Jarod Wen wrote: > Is it a proper design to use a NSDocument as a variable of another > NSDocument? > > I am now working on an application which generates some information from a > movie. The information generated will be showed as a table, and the > information in the table can be saved/opened. Multiple types of information > are possible so for one movie there may be several tables. > > I used the NSDocument architecture for the movie document, and I am a little > bit confused about the hierarchy now: is it possible to set the table as > NSDocument and use it as a variable as the movie document? i.e., if I use > MovieDocument for the movie and TableDocument for the table, it is ok to use > a TableDocument object as a variable of the MovieDocument? Or any better > pattern for this? The question isn't whether one document object can contain a reference to another document object. The question is what's supposed to happen later when the derived (table) document is re-opened. If the table refers to information in the original (movie) document, you'll need to open the movie document too. That's feasible (though I'd be a little careful about making assumptions about recursion-safety in NSDocumentController methods), but require careful error handling -- what if one document file has moved or disappeared? OTOH if you have to open both documents together anyway, it sounds like your table perhaps should be *in* the movie document (that is, its data model should be part of the movie document data model) and you should provide multiple window types on the movie document. So that's the first question you should decide -- whether you really need 2 documents, or whether you need 2 windows onto the same document. ___ 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: Keeping closed windows in the Window menu
On Jan 18, 2010, at 11:23, Andreas Eriksson wrote: > What's the recommended way of keeping a window in the Window menu > (like e.g. Address book and iChat does) so that it can be brought back > even after it has been closed? Here's the code (in the window controller) I use to do this: - (void) orderOutMyWindow: (id) sender { NSString* title = self.window.title; [self.window orderOut: sender]; [NSApp addWindowsItem: self.window title: title filename: NO]; } - (BOOL) windowShouldClose: (id) sender { [self performSelector: @selector (orderOutMyWindow:) withObject: sender afterDelay: 0.0]; return NO; } ___ 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: Keeping closed windows in the Window menu
- [NSWindow setExcludedFromWindowsMenu:]? On Jan 18, 2010, at 11:58 AM, Andreas Eriksson wrote: That would still require some effort to prevent the window (and the separator) to be listed twice, I assume? On Mon, Jan 18, 2010 at 8:38 PM, Steve Christensen wrote: Just a guess that they're known windows, so items are added to the Window menu in IB. On Jan 18, 2010, at 11:23 AM, Andreas Eriksson wrote: What's the recommended way of keeping a window in the Window menu (like e.g. Address book and iChat does) so that it can be brought back even after it has been closed? ___ 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: CALayer with No Animation
On Jan 18, 2010, at 11:24 AM, Richard Somers wrote: > An observation. CAOpenGLLayer provides for manually controlling animations. > CALayer uses automatic animations. Why the difference? I'm not certain what you mean by this. All layers participate in implicit animations, although each layer type can specify which keys are implicitly animated (and this can be further customized by developers). If you are saying that CAOpenGLLayer has a different set of default implicit animations, thats entirely possible, but they both should use the same mechanism. -- David Duncan Apple DTS Animation and Printing ___ 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: Keeping closed windows in the Window menu
Just a guess that they're known windows, so items are added to the Window menu in IB. On Jan 18, 2010, at 11:23 AM, Andreas Eriksson wrote: What's the recommended way of keeping a window in the Window menu (like e.g. Address book and iChat does) so that it can be brought back even after it has been closed? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSColorPanel question
A bit of the crash log showing the backtrace and reason for crashing would be much more helpful than just saying that it crashed. Secondly, NSColorPanel is a floating panel so its behavior isn't really oriented towards modally opening it, selecting a color and closing it. You'd normally click in a NSColorWell and the NSColorPanel would be made visible if it wasn't already. Then any changes made to the color in the NSColorPanel are reflected in the NSColorWell. The way you have it configured below, your action method is being called every time the color changes if, say, you were dragging the mouse over the color wheel or moving a color component slider. If you were assuming that -changeColor: was being called once when the "final" color was selected, you might be doing something to initiate the crash. On Jan 18, 2010, at 5:39 AM, Matthias Schmidt wrote: Hello, I'm a bit stuck with NSColorPanel, while trying to write a plugin for another app, which should open the color picker, select a color, close it and return the color. I use this code here, but as soon as I click in the panel it is crashing: -(void)setPicker:(id)sender { panel = [NSColorPanel sharedColorPanel ] ; [ panel setColor: myColor ]; [ panel setMode: (NSColorPanelMode)pMode ]; [ panel setContinuous: YES ]; [ panel setTarget: sender ]; //myColor [ panel setAction: @selector( changeColor:) ]; [ panel makeKeyAndOrderFront: nil ]; //self } I'd be happy, if someone could point me in the right direction ___ 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: CALayer with No Animation
On Jan 18, 2010, at 10:11 AM, David Duncan wrote: -drawInContext: is too early to stop the creation of the animation, as it occurs after -drawInContext: finishes and the layer's contents are set. You need to override -actionForKey:, watch for the @"contents" key, and return nil. There are actually lots of ways to do this so I highly recommend you read the documentation for that action, as the other methods may be useful in other contexts. Thank you so much. That worked. An observation. CAOpenGLLayer provides for manually controlling animations. CALayer uses automatic animations. Why the difference? --Richard ___ 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
Keeping closed windows in the Window menu
Hi, What's the recommended way of keeping a window in the Window menu (like e.g. Address book and iChat does) so that it can be brought back even after it has been closed? / Andreas ___ 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
Use NSDocument as a variable of another NSDocument
Hi Jedis, Is it a proper design to use a NSDocument as a variable of another NSDocument? I am now working on an application which generates some information from a movie. The information generated will be showed as a table, and the information in the table can be saved/opened. Multiple types of information are possible so for one movie there may be several tables. I used the NSDocument architecture for the movie document, and I am a little bit confused about the hierarchy now: is it possible to set the table as NSDocument and use it as a variable as the movie document? i.e., if I use MovieDocument for the movie and TableDocument for the table, it is ok to use a TableDocument object as a variable of the MovieDocument? Or any better pattern for this? Thanks in advance! -- J.W. ___ 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: wait for sheet result
Oh good :) I do try not to get carried away with them. But try removing sheet 1 before displaying sheet 2 (in a sequence). It looks absolutely terrible, things sliding up and down all over the place, makes me quite dizzy. I hear a rumour that MS Office does this on the Mac... In some places, I 'morph' sheet 1 into sheet 2, and provide a 'Back' button in sheet 2 to morph back (a bit like the System Preferences pane, except there they morph the entire window). I'm not sure if that's an improvement or not, to be honest, but I think that more than 2 overlaid sheets would give the Apple HIG people hissy fits. And yes, my app could no doubt be structured better. I'll tackle that some day. Paul Sanders. - Original Message - From: "Matt Neuburg" To: Sent: Monday, January 18, 2010 6:31 PM Subject: Re: wait for sheet result So "no cascading sheets" is just a canard. It's permitted, it's standard, and sometimes it is obviously the right thing to do. m. ___ 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: wait for sheet result
On or about 1/7/10 10:25 PM, thus spake "cocoa-dev-requ...@lists.apple.com" : > Message: 16 > Date: Fri, 8 Jan 2010 17:23:06 +1100 > From: Graham Cox > Subject: Re: wait for sheet result> > > On 08/01/2010, at 4:24 PM, Jerry Krinock wrote: > >> The Sheet Programming Guide notes that Cocoa does not support nested (or >> "piled on top of one another") sheets, and states that your app should make >> sure this never happens, but doesn't give you any assistance in doing so. >> Given that sheets frequently present errors or other unexpected results, we >> really need a means for queueing multiple sheets, in the **unlikely** event >> that one's app should ever need to present two sheets to the user in rapid >> succession. Hey, I know it's not pretty, but one should design to handle the >> corner cases. > > > While the guide does say this: > > "Cocoa does not support the notion of cascading, or nested sheets. Per Apple > Human Interface Guidelines, „when the user responds to a sheet, and another > sheet for that document opens, the first sheet must close before the second > one opens.‰ > > In fact nested sheets do work fine - if you make a sheet the parent of a > second sheet, it will work OK. What doesn't work is if you try and attach more > than one sheet to the same parent. > > I'm not saying that cascaded sheets is good UI, but if there is no option, > there doesn't seem to be anything to stop you. In any document-based Cocoa app (such as TextEdit), choose File > Save As and in the (sheet) Save dialog enter the name of an existing document. When you click Save, a second sheet appears over the first sheet, asking whether you want to cancel or replace the existing document. At least, that's the case in Snow Leopard (I didn't try in any earlier system). So "no cascading sheets" is just a canard. It's permitted, it's standard, and sometimes it is obviously the right thing to do. m. -- matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/ pantes anthropoi tou eidenai oregontai phusei Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf AppleScript: the Definitive Guide, 2nd edition http://www.tidbits.com/matt/default.html#applescriptthings Take Control of Exploring & Customizing Snow Leopard http://tinyurl.com/kufyy8 RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html TidBITS, Mac news and reviews since 1990, http://www.tidbits.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: NSServices error parameter ignored?
On Mon, Jan 18, 2010 at 11:38 AM, Greg Parker wrote: > On Jan 18, 2010, at 8:52 AM, Jim Turner wrote: >> I've created and am successfully calling a service in my application. >> But when an error is encountered and I set an error string, it doesn't >> seem to go anywhere. The docs say its supposed to be logged to the >> console but I see nothing. Is this a bug or am I missing something? > > Looks like a bug. I think there's a miscommunication between AppKit and CF > that drops the error after your service is called. You should file a bug > report. > > > -- > Greg Parker gpar...@apple.com Runtime Wrangler > Thanks for the reply, Greg. I've filed a bug -- Jim http://nukethemfromorbit.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: function/library to pack javascript?
On Mon, Jan 18, 2010 at 3:17 AM, Eric Boo wrote: > I'm trying to find a C/Objective-C function or library that will help me > pack javascript, something like YUI Compressor or Dean Edwards's packer. It may not be as aggressive as you'd like, but Doug Crockford's jsmin has C source code available: http://www.crockford.com/javascript/jsmin.html ___ 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
function/library to pack javascript?
Hi All, I'm trying to find a C/Objective-C function or library that will help me pack javascript, something like YUI Compressor or Dean Edwards's packer. Instead of doing this online, I'll need to do substitutions on the javascript code before packing it. Couldn't find a solution online. Does anyone know of library or a function that can help me do this? Thanks! Eric ___ 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: NSServices error parameter ignored?
On Jan 18, 2010, at 8:52 AM, Jim Turner wrote: > I've created and am successfully calling a service in my application. > But when an error is encountered and I set an error string, it doesn't > seem to go anywhere. The docs say its supposed to be logged to the > console but I see nothing. Is this a bug or am I missing something? Looks like a bug. I think there's a miscommunication between AppKit and CF that drops the error after your service is called. You should file a bug report. -- Greg Parker gpar...@apple.com Runtime Wrangler ___ 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
Docs by Contradiction: -isDocumentEdited vs. -updateChangeCount:
In documentation, updateChangeCount: "if the change count is 0, the document has no changes to save, and if the change count is greater than 0, the document has been edited and is unsaved" isDocumentEdited "Returns YES if the receiver has changes that have not been saved, NO otherwise." I could write better code if I had a more direct definition. If I interpret "document has been edited and is unsaved" to mean the same as "has changes that have not been saved", then the converse follows by contradiction and thus the implementation of -isDocumentEdited must be simply this: - (BOOL)isDocumentEdited { return (_changeCount > 0) ; } Am I correct? Thanks! Jerry ___ 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: CALayer with No Animation
On Jan 18, 2010, at 7:04 AM, Richard Somers wrote: > - (void)drawInContext:(CGContextRef)context > { > [CATransaction begin]; > [CATransaction setValue:(id)kCFBooleanTrue > forKey:kCATransactionDisableActions]; > > // Do some CG drawing ... > > [CATransaction commit]; > } > > The problem is there is a remnant of an animation in the CALayer instance > when the view is resized. It is not a full animation, but appears to be just > one or two frames of an animation that occurs when the view is resized. Does > anyone know what is happening and how it can be corrected? -drawInContext: is too early to stop the creation of the animation, as it occurs after -drawInContext: finishes and the layer's contents are set. You need to override -actionForKey:, watch for the @"contents" key, and return nil. There are actually lots of ways to do this so I highly recommend you read the documentation for that action, as the other methods may be useful in other contexts. -- David Duncan Apple DTS Animation and Printing ___ 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: NSURLRequest and NSOperationQueue
On 18 Jan 2010, at 16:37, Clint Shryock wrote: > I had the same issue in the past using NSOperationQueue and NSURLConnection, > and I resolved it by simply telling NSURLConnection to send using > synchronously using sendSynchronousRequest:returningResponse:error: > > Would that not take care of the issue? That is no different to servicing the run loop for an 'asynchronous' operation and is generally a bad idea in the worker threads; it needlessly removes them from the worker pool until the response has arrived. Please see my previous post for alternatives. 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: Bindings Problem
> On Sun, 2010/01/17, Ken Thomases wrote: >> On 2010 Jan 17, at 11:15, Jeffrey Oleander wrote: >>> On Sat, 2010/01/16, Ken Thomases > wrote: On 2010 Jan 14, at 17:11, Carter R. Harrison wrote: My model is an NSMutableSet that contains NSMutableDictionaries. >>> >>> I think this is asking for trouble. A set of >>> mutable dictionaries doesn't make much sense. >>> >>> ..."Equal" is determined by the -isEqual: and >>> -hash methods, not by identity (memory location). >> So, it's quite possible that he has a "hash" used by >> the NSMutableSet which doesn't depend on the contents >> of the mutable dictionary once it's been created. > > Huh? The hash in question is that of the mutable > dictionaries. He doesn't get to decide this. > It's a near certainty that the hash of a dictionary is > sensitive to its contents. First, logically, how else > would the NSDictionary implement equality? Second, the > documentation I cited virtually asserted that it's so. > > So, if you mutate a dictionary while it's inside a > collection, that will cause trouble. The documentation > I cited says this, too, without equivocation. > > He also doesn't get to decide on the hash of the set, if > that's what you were thinking about. > > He could implement some custom class and decide how its > hash is implemented, but that's beside the point I was > making. In fact, that was one of my suggested > solutions. > > In other words, I'm not sure what you're trying to say. http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Collections/Articles/Sets.html "Set Fundamentals: Note that if mutable objects are stored in a set, either the hash method of the objects shouldn’t depend on the internal state of the mutable objects or the mutable objects shouldn’t be modified while they’re in the set (note that it can be difficult to know whether or not a given object is in a collection)." So, you can use your own hash function to determine where in the set each item is stored. In this case, each item stored in the set is an NSMutableDictionary. http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/Reference/Reference.html "Internally, a dictionary uses a hash table to organize its storage and to provide rapid access to a value given the corresponding key. However, the methods defined in this cluster insulate you from the complexities of working with hash tables, hashing functions, or the hashed value of keys. The methods described below take keys directly, not their hashed form." So, you may use your own hash function to create your keys... or not, as you wish. But then the NSDictionary and NSMutableDictionary will hash the keys you pass to their methods using their own, internal, hash function, to determine where objects are stored in the dictionary. But my primary point was to ask the original poster to think about why he is using this arrangement of instances of NSMutableDictionary stored in an NSMutableSet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSColorPanel question
On Jan 18, 2010, at 5:39 AM, Matthias Schmidt wrote: > Hello, > I'm a bit stuck with NSColorPanel, while trying to write a plugin for > another app, which should open the color picker, select a color, close > it and return the color. > > I use this code here, but as soon as I click in the panel it is crashing: What is the backtrace of the crash? -corbin > -(void)setPicker:(id)sender { > >panel = [NSColorPanel sharedColorPanel ] ; >[ panel setColor: myColor ]; >[ panel setMode: (NSColorPanelMode)pMode ]; >[ panel setContinuous: YES ]; >[ panel setTarget: sender ]; //myColor >[ panel setAction: @selector( changeColor:) ]; >[ panel makeKeyAndOrderFront: nil ]; //self > } > > I'd be happy, if someone could point me in the right direction > > thanks > Matthias > ___ ___ 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
NSServices error parameter ignored?
I've created and am successfully calling a service in my application. But when an error is encountered and I set an error string, it doesn't seem to go anywhere. The docs say its supposed to be logged to the console but I see nothing. Is this a bug or am I missing something? My code: -(void) myCoolService:(NSPasteboard *)pboard userData:(NSString *)data error:(NSString **)error { if( ) { } else { if( error ) *error = [NSString stringWithString:@"This error never shows"]; } } Thanks -- Jim http://nukethemfromorbit.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: NSURLRequest and NSOperationQueue
I had the same issue in the past using NSOperationQueue and NSURLConnection, and I resolved it by simply telling NSURLConnection to send using synchronously using sendSynchronousRequest:returningResponse:error: Would that not take care of the issue? +Clint On Sun, Jan 17, 2010 at 1:55 PM, J. Scott Tury wrote: > The issue that Dave has run into is that when you call the asynchronous > NSURLConnection call, NSURLConnection looks to see what thread you are > calling it on, and it will only call your delegate back on that Thread (if > it exists). If you exit your NSOperation main method, your thread is going > to be cleaned up, and you will never get the delegate callbacks you want. > > Re-reading Dave's original email, I think what's probably happening to him > is that he may be switching the runLoops of ht eNSURLConnection BEFORE it > has actually started. Here's the comment from the documentation: > > You may call these methods after the connection has started. However, if > the connection is scheduled on multiple threads or if you are not calling > these methods from the thread where the connection is scheduled, there is a > race between these methods and the delivery of delegate methods on the other > threads. The caller must either be prepared for additional delegation > messages on the other threads, or must halt the run loops on the other > threads before calling these methods to guarantee that no further callbacks > will occur. > > Scott > > ___ > > 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/cts3e1%40gmail.com > > This email sent to cts...@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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Bundle and window server interaction
Dave Keck wrote: > That seems like a silly requirement for UI interaction... > > It seems you can get around it by making your app bundled and setting > the LSUIElement key in your Info.plist, though. Or use TransformProcessType to elevate your Unix style executable to GUI status: OSStatus err = 0; ProcessSerialNumber psn = {0, kCurrentProcess}; err = TransformProcessType(& psn, kProcessTransformToForegroundApplication); (This is what rb-appscript calls the first time a standard GUI-less ruby process tries to display a Standard Additions dialog.) HTH has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.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: Typo in notification name
On Mon, Jan 18, 2010 at 4:20 AM, Mark Munz wrote: > Apple usually addresses binary compatibility by changing behavior if > you link against a newer major SDK. So a behavior changes if you link > against 10.6 vs. 10.5. Apple has done this numerous times. > > With notifications, they could also send out both notifications. I'm > thinking com.apple.loginItemsListDidChange doesn't happen often enough > to cause a performance hit if you sent out both each time. The other thing to consider is that if you are observing a public notification, you should use the symbolic constant for that notification when it is available. In that case, the underlying value doesn't matter. The public API for interacting with, and observing, the login items list is LSSharedFileList. - Jim ___ 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: Bundle and window server interaction
On 18 Jan 2010, at 14:30, jonat...@mugginsoft.com wrote: > On 18 Jan 2010, at 14:22, Alastair Houghton wrote: > >> Quite possibly. Have you tried calling NSApplicationLoad() at the top of >> your main() function? > Makes no difference as far as I can tell. > There is a practical point here as I am trying to launch user interacting > AppleScript from a foundation tool. OK, so how about this: Cut here cd /tmp cat > tst.m < int main (void) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; OSStatus error; ProcessSerialNumber ourPSN; NSApplicationLoad(); GetCurrentProcess(&ourPSN); TransformProcessType(&ourPSN, kProcessTransformToForegroundApplication); SetFrontProcess(&ourPSN); NSAppleScript *as = [[NSAppleScript alloc] initWithSource:@"display dialog \"hello\""]; NSDictionary *errorDict = nil; [as executeAndReturnError:&errorDict]; if (errorDict) { NSLog(@"%@", errorDict); return 1; } [pool release]; return 0; } EOF gcc tst.m -framework Cocoa -o tst ./tst -- Works for me. The critical line seems to be the TransformProcessType() call, and the problem appears to be related to AppleScript rather than merely the window server connection. Kind regards, Alastair. -- http://alastairs-place.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
CALayer with No Animation
I am trying to draw in a CALayer subclass with all animation off. The layer in question is a sublayer of a CAOpenGLLayer which is used in a layer-hosted view. When the view is resized, the CALayer bounds are updated and the layer is redrawn. - (void)updateBounds { [CATransaction begin]; [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions]; CGRect rect = [[self superlayer] bounds]; [self setFrame:rect]; [CATransaction commit]; } - (void)drawInContext:(CGContextRef)context { [CATransaction begin]; [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions]; // Do some CG drawing ... [CATransaction commit]; } The problem is there is a remnant of an animation in the CALayer instance when the view is resized. It is not a full animation, but appears to be just one or two frames of an animation that occurs when the view is resized. Does anyone know what is happening and how it can be corrected? --Richard ___ 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: Bundle and window server interaction
On 18 Jan 2010, at 14:30, jonat...@mugginsoft.com wrote: >> Quite possibly. Have you tried calling NSApplicationLoad() at the top of >> your main() function? > Makes no difference as far as I can tell. > There is a practical point here as I am trying to launch user interacting > AppleScript from a foundation tool. That's odd, because the following program works just fine (paste this into a Terminal window to try it): - Cut here - cd /tmp cat > tst.m < int main (void) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSApplicationLoad(); NSRunAlertPanel(@"Test", @"Testing", @"OK", nil, nil); [pool release]; return 0; } EOF gcc tst.m -framework Cocoa -o tst ./tst while omitting the NSApplicationLoad() causes it to fail with : kCGErrorInvalidConnection: CGSGetCurrentCursorLocation: Invalid connection : kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged. You *definitely* need the NSApplicationLoad() (or a call to [NSApplication sharedApplication]) if you want a window server connection. I think, from trying it just now, that the problem is related to AppleScript rather than to the window server connection. Kind regards, Alastair. -- http://alastairs-place.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: Bundle and window server interaction
> Yes - I'd recommend placing your helper into your main app's > Contents/MacOS directory, per > http://developer.apple.com/mac/library/technotes/tn2007/tn2206.html. > (Although Apple seems to favor putting their helpers in > Contents/Resources, at least on 10.5.) I forgot to add that helper _bundles_ go directly into Contents, per the linked article. ___ 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: Bundle and window server interaction
> Silliness apart it's a legitimate question. Of course - I meant AS requiring one's app to be a bundle to interact with the user seemed strange. > I want to investigate NSAppleScript user interaction from within a foundation > tool. > The tool is already part of my app bundle. > > I don't really want to ship two bundles and moving the tool into the main > bundle executable folder causes other headaches on 10.5/10.6. > perhaps I can embed one app within another and utilise LSUIElement that way. Yes - I'd recommend placing your helper into your main app's Contents/MacOS directory, per http://developer.apple.com/mac/library/technotes/tn2007/tn2206.html. (Although Apple seems to favor putting their helpers in Contents/Resources, at least on 10.5.) What sort of issues did you have moving your helper tool into the MacOS directory of your bundle? ___ 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: Bundle and window server interaction
On 18 Jan 2010, at 14:28, Dave Keck wrote: > That seems like a silly requirement for UI interaction... > > It seems you can get around it by making your app bundled and setting > the LSUIElement key in your Info.plist, though. Silliness apart it's a legitimate question. I want to investigate NSAppleScript user interaction from within a foundation tool. The tool is already part of my app bundle. I don't really want to ship two bundles and moving the tool into the main bundle executable folder causes other headaches on 10.5/10.6. perhaps I can embed one app within another and utilise LSUIElement that way. Thanks Jonathan ___ 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: Bundle and window server interaction
That seems like a silly requirement for UI interaction... It seems you can get around it by making your app bundled and setting the LSUIElement key in your Info.plist, though. ___ 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: Bundle and window server interaction
On 18 Jan 2010, at 13:43, jonat...@mugginsoft.com wrote: > Can anyone cast any light on the interaction between the bundle structure and > the window server? > > The following modified Cocoa app main function displays a dialog when run as > an app. > If the executable is extracted from the bundle and run it fails (no user > interaction allowed). > > The thing is that NSApplicationMain() is not executed. > So the window server connection must arise as a result of the executable's > existence with a bundle. Quite possibly. Have you tried calling NSApplicationLoad() at the top of your main() function? Kind regards, Alastair. -- http://alastairs-place.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
Bundle and window server interaction
Can anyone cast any light on the interaction between the bundle structure and the window server? The following modified Cocoa app main function displays a dialog when run as an app. If the executable is extracted from the bundle and run it fails (no user interaction allowed). The thing is that NSApplicationMain() is not executed. So the window server connection must arise as a result of the executable's existence with a bundle. Or are my thoughts out of whack (again)? #import int main(int argc, char *argv[]) { //return NSApplicationMain(argc, (const char **) argv); NSAppleScript *as = [[NSAppleScript alloc] initWithSource:@"display dialog \"hello\""]; NSDictionary *errorDict = nil; [as executeAndReturnError:&errorDict]; if (errorDict) { NSLog(@"%@", errorDict); return 1; } } 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: [iphone] Release Navigation View Controller Question
Hi this is a follow up question on memory management. In my class BrowseViewController, I have a UITableView and 2 NSMutableArrays. @interface BrowseViewController : UIViewController { IBOutlet UITableView *tableView; NSMutableArray *tableList; NSMutableArray *cfrTitleList; } @property(nonatomic, retain) UITableView *tableView; @end Now the BrowseViewController has a few "child" Navigational controllers. This allows the user to drill down. My question is, in the BrowseViewController.m dealloc method, if I release the two NSMutableArrays, I receive the error “EXC_BAD_ACCESS”. If I don't release the NSMutableArrays, does this mean the navigationController takes ownership of the NSMutableArrays? Thanks for all the help. Phil On Jan 17, 2010, at 6:44 AM, Philip Vallone wrote: > Thanks Tom. Great explanation! > > > On Jan 17, 2010, at 6:05 AM, Tom Davie wrote: > >> Yes, that code is 100% fine. >> >> Here's the logic from purely your point of view. >> >> You allocate browserviewController and in doing so take ownership. >> You do some stuff with browserviewController. >> You are finished with browserviewController, and don't want to do anything >> else with it, so you resign ownership. >> >> From a more global perspective, the navigationController becomes interested >> in browserviewController when you ask it to push it, and it too takes >> ownership, so when *you* release, the navigationController still has a >> handle on the controller, and keeps hold of it until it decides it's done >> with it. >> >> Bob >> >> On Sun, Jan 17, 2010 at 10:30 AM, Philip Vallone >> wrote: >> >> Hi, >> >> I have Navigation based application. When I switch from one view to the next >> I use the following code. In the below code, is it ok to release >> "browseviewController"? >> >> >> BrowseViewController *browseviewController = [[BrowseViewController alloc] >> initWithNibName:@"BrowseViewController" bundle:nil]; >> [browseviewController setTitle:@"Browse By Title"]; >> [self.navigationController pushViewController:browseviewController >> animated:YES]; >> // ok to release? >> [browseviewController release]; >> >> >> Thanks, >> >> Phil___ >> >> 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/tom.davie%40gmail.com >> >> This email sent to tom.da...@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/philip.vallone%40verizon.net > > This email sent to philip.vall...@verizon.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSColorPanel question
Hello, I'm a bit stuck with NSColorPanel, while trying to write a plugin for another app, which should open the color picker, select a color, close it and return the color. I use this code here, but as soon as I click in the panel it is crashing: -(void)setPicker:(id)sender { panel = [NSColorPanel sharedColorPanel ] ; [ panel setColor: myColor ]; [ panel setMode: (NSColorPanelMode)pMode ]; [ panel setContinuous: YES ]; [ panel setTarget: sender ]; //myColor [ panel setAction: @selector( changeColor:) ]; [ panel makeKeyAndOrderFront: nil ]; //self } I'd be happy, if someone could point me in the right direction thanks Matthias ___ 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
setting the searchResultsTableView of a UISearchDisplayController to grouped style
Hey everyone! I've been trying to use a UISearchDisplayController hooked up in IB with my UITableView and everything works fine except for the fact that I need the resulting table view to be of the UITableViewStyleGrouped style, which I can not currently achieve. Any ideas how to go on about it? Also, I think I might have found a "bug" in the docs. Check out the "Discussion" part. Thanks for any pointers! Ben searchResultsTableView The table view in which the search results are displayed. (read-only) @property(nonatomic, readonly) UITableView *searchResultsTableView Discussion This method creates a new table view if one does not already exist. Availability Available in iPhone OS 3.0 and later. Related Sample Code TableSearch Declared In UISearchDisplayController.h ___ 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: Blocking for input during a loop?
> - Original Message > From: Kyle Sluder > To: Per Bull Holmen > Cc: cocoa-dev@lists.apple.com > Sent: Mon, January 18, 2010 6:29:32 AM > Subject: Re: Blocking for input during a loop? > > > On Sun, Jan 17, 2010 at 1:59 PM, Per Bull Holmen wrote: > > Is it possible, in Cocoa, do program a loop which goes something like this: > > > > for i=1 to 20 > > do something > > block for GUI user input > > do something with the input > > repeat > > This is a bad idea. Don't block the UI thread, because then the user > will see a beachball. > > Sounds like you need to reread the Cocoa Event Handling Guide: > http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/EventOverview/Introduction/Introduction.html > > Your architectural difficulties also betray an unfamiliarity with MVC > design. I suggest you read the Cocoa Design Patterns section of the > Cocoa Fundamentals Guide, delve into the AppKit classes to see how > that document relates to the actual framework, and then iterate your > own design over and over (perhaps with pencil and paper for a while), > keeping in mind the things you've learned from the documentation and > from using the classes in AppKit. AppKit classes need to maintain a > lot of state information, particularly when doing things like dragging > or other input-driven processes. Here is the relevant document: > http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/CocoaDesignPatterns.html#//apple_ref/doc/uid/TP40002974-CH6-SW6 > > --Kyle Sluder Thanks for the response. I have created several applications the "standard Cocoa way" so to speak, since 10.2, using the target/action mechanisms, responder chain, bindings, and MVC-paradigm. It's great! This time, I firstly also did it the way I'm used to doing it, but as I thought I had explained to you, it got very cumbersome for me to use for the task at hand. The controller classes got very complex, with too many state variables - too many potential bugs, it got very difficult to extend, so I thought I'd find another way of doing it. I am absolutely convinced that I should learn a lot more about the stuff you want me to read, and it's quite possible I could have done it better, but I do have a problem with you asking me to read about 500 pages of documentation, without first giving me a reason to believe it would solve my problem. You say my initially proposed loop is a bad idea - but lots of applications use this type of loop. The difference is that they do it only inside one window, and block user access to all other parts of the application (modal windows). They do this for wizards and the like, which are far closer to how the game will eventually be than a "regular" application. So, maybe that's the way to go? As I thought I had made clear, the loop doesn't have to happen in the UI (main) thread. It's just that if the loop wants to interact with views, controls etc., I'd have to arrange for messaging to the main thread, which could also get awkward. Per ___ 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
Sending FAX using Cocoa Framework
Hi all, I would like to send fax using the cocoa application. I found some methods related to fax like NSPrintFaxModem etc(deprecated methods). But I do not know how to proceed with this? Help me in this. Thanks, Ramesh.P ___ 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: Typo in notification name
Apple usually addresses binary compatibility by changing behavior if you link against a newer major SDK. So a behavior changes if you link against 10.6 vs. 10.5. Apple has done this numerous times. With notifications, they could also send out both notifications. I'm thinking com.apple.loginItemsListDidChange doesn't happen often enough to cause a performance hit if you sent out both each time. Mark On Mon, Jan 18, 2010 at 1:07 AM, Graham Cox wrote: > > On 18/01/2010, at 6:29 PM, Eimantas Vaičiūnas wrote: > >> This typo seems to be dating since 2006 (according to this thread: >> http://www.osxentwicklerforum.de/thread.php?postid=39885). Was apple >> notified about this? > > > Problem is that even if they have they can't fix it without breaking binary > compatibility. That's often the way with typos - another thing you need to > take care over. > > --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/unmarked%40gmail.com > > This email sent to unmar...@gmail.com > -- Mark Munz unmarked software http://www.unmarked.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: Typo in notification name
On 18/01/2010, at 6:29 PM, Eimantas Vaičiūnas wrote: > This typo seems to be dating since 2006 (according to this thread: > http://www.osxentwicklerforum.de/thread.php?postid=39885). Was apple > notified about this? Problem is that even if they have they can't fix it without breaking binary compatibility. That's often the way with typos - another thing you need to take care over. --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