Send POST data to browser
Hi, I'm new in programming for iPhone and I have a problem. I have a website with login form and I want to write a program on iPhone which open this website without authentication. I thought to launch a brwoser from my application and send a POST data with username and password, but I have no idea how to do that. I can launch browser with url using this code: NSURL *url = [NSURL URLWithString: @https://www.example.com/index.php;]; [[UIApplication sharedApplication] openURL: url]; but I don't know how to send post data. I tried also another solution: send post data from my application to website and then get a response, but then I don't know how to open returned page in browser. I used this code: NSString *postString = [[NSString alloc] initWithFormat:@username=%@password=%@, [self urlEncodeValue: username], [self urlEncodeValue: password]]; NSData *requestData = [NSData dataWithBytes: [postString UTF8String] length: [postString length]]; NSURL *url = [NSURL URLWithString: @https://www.example.com/index.php;]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL: url]; [request setHTTPMethod: @POST]; [request setValue: @application/x-www-form-urlencoded forHTTPHeaderField: @Content-Type]; [request setHTTPBody: requestData]; NSURLResponse *response; NSError *error; NSData *returnData = [NSURLConnection sendSynchronousRequest: request returningResponse: response error: error]; NSString *dataReturned = [[NSString alloc] initWithData: returnData encoding: NSASCIIStringEncoding]; I will be appreciate of any help. Best regards Bartosz Bialecki Wiedza. Wikipedia. Encyklopedia. Zrozum otaczający Cię świat: http://klik.wp.pl/?adr=http%3A%2F%2Fwikipedia.wp.plsid=857 ___ 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
Catch exception in NSArrayController
I have a classical binding usecase: A NSArrayController is used for displaying the columns of a NSTableView. The columns itself therefore use the arrangedObject method of the NSArrayController. In the get methods of the model itself (which normally return an NSString* which should be displayed in the column), there could occur an exception. I want to catch that exception in the NSArrayController. I therefore subclassed the NSArrayController and overwrote valueForKeyPath with a simple: - (id)valueForKeyPath:(NSString *)keyPath { try { [super valueForKeyPath:keyPath]; } catch (...) { // want to get here, if there is an exception thrown within the model class } } Unfortunately it is only called with arrangedObjects. At that point no exception is thrown yet. Somewhere after that a valueForKeyPath must be executed on that returned arrangedObjects. Since I have not subclassed this proxy class, I cannot intercept its valueForKeyPath method and therefore cannot catch the exception. Is there a simple way to catch exceptions in the controller class which is thrown during calling a get method (over binding mechanims)? Thanks for any help. Konrad ___ 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
Fwd: [SOLVED] NSTreeController setSelectionIndexPath depends on sort order
Just for the record: I found the solution on the net: http://wilshipley.com/blog/2006/04/pimp-my-code-part-10-whining-about.html . But instead of going through the whole tree to find an object, I simply store the complete object hierarchy, so that I only have to descent to that children, which are also in the requested object hierarchy. Therefore finding the object is much faster. Since I operate on content rather than on arrangedObjects I do not have to mess around with proxy objects. Just be carefull to apply the same sort order to the contents array. Hope this will help others with the same problem. Konrad Am 25.08.2009 um 19:45 schrieb Konrad Windszus: I have a NSTreeController which is connected to a NSOutlineView. I wish to have links to specific entries in the NSTreeController. With these links I want to select those items. I therefore use the NSIndexPath. Unfortunately the NSIndexPath becomes invalid if the sort order is changed by the user. How can I have links to items in NSTreeController (which I can then select with the help of the link), which are independent of the sort order? Thanks for any help Konrad ___ 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/konrad_w%40gmx.de This email sent to konra...@gmx.de ___ 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: getline 'free' problem
On 17/09/2009, at 2:42 AM, Jason Foreman wrote: On Sep 16, 2009, at 5:41 AM, Aron Nopanen wrote: On Snow Leopard (using gcc 4.2), I'm getting a 'double free' error in the guts of the C++ std::getline. The 'free' in question is being performed by std::string::reserve. This happens any time I run 'getline' (reading from cin) on a fresh, virgin string. (The error is only seen in the Debug configuration.) Try removing these definitions from the preprocessor flags of your Debug configuration: _GLIBCXX_DEBUG=1 _GLIBCXX_DEBUG_PEDANTIC=1 I think there are some issues when those are defined that can cause some unexpected behavior, such as what you're seeing. Disabling _GLIBCXX_DEBUG does mask the problem. However, the issue is still present (though it probably wouldn't cause any problem in practice). I spent some quality time with the std::string source code and figured out what's going on. It comes down to some conditional compilation driven by flag '_GLIBCXX_FULLY_DYNAMIC_STRING'. libstdc++.6.dylib was apparently compiled with it set; my program was compiled without it set. This flag is used in basic_string.h. If not defined, all newly-created empty strings share a single, statically-defined internal representation. In the functions that deal with reference-counting shared internal string representations, there is conditionally- compiled special-casing to check for this special empty-string representation: reference counts aren't updated for it, and it's never freed. If _GLIBCXX_FULLY_DYNAMIC_STRING is defined, this special-casing goes away. So, the empty string was created in my code (by these inlined functions) using the special static empty string representation. The call to std::getline in libstdc++.6.dylib then ended up dropping the reference to this static representation. When doing so (because _GLIBCXX_FULLY_DYNAMIC_STRING was defined), it decremented the refcount and tried to free the non-malloced object. Hence: error. Moral of the story: C++ programs on OS X should set this compiler flag, to be consistent with the shared library settings. I'll file a radar, as I think it should be set in the various versions of c+ +config.h, but it's commented out in all of them. For anybody who's interested, here are the relevant bits from /usr/ include/c++/4.2.1/bits/basic_string.h: void _M_dispose(const _Alloc __a) { #ifndef _GLIBCXX_FULLY_DYNAMIC_STRING if (__builtin_expect(this != _S_empty_rep(), false)) #endif if (__gnu_cxx::__exchange_and_add_dispatch(this-_M_refcount, -1) = 0) _M_destroy(__a); } // XXX MT void _M_destroy(const _Alloc) throw(); _CharT* _M_refcopy() throw() { #ifndef _GLIBCXX_FULLY_DYNAMIC_STRING if (__builtin_expect(this != _S_empty_rep(), false)) #endif __gnu_cxx::__atomic_add_dispatch(this-_M_refcount, 1); return _M_refdata(); } // XXX MT Sorry for the digression; now back to your regular Cocoa programming. Cheers, Aron ___ 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
+keyPathsForValuesAffectingKey not working for a category-implemented property on a CoreData class
I'm having trouble defining this briefly. I am using CoreData-generated classes, and extending them by defining methods and calculated properties in categories on the generated classes (so they don't get overridden if I regenerate the classes). All works fine for properties with CoreData-defined types (scalars, strings, etc.), but not for some hackery I'm using for properties with other types. In a CoreData entity called Topic, I have a to-many relationship (to other Topics) called children to implement a hierarchy. In a category on Topic, I have implemented a property called orderedChildren which returns a sorted array of the children. In order to ensure that orderedChildren is recognized as a property of the Topic entity, I have defined orderedChildren as an optional, transient attribute of Topic of unknown type (since NSArray or id isn't supported). CoreData generates a property declaration for orderedChildren with type UNKNOWN_TYPE, and I have #defined UNKNOWN_TYPE as id in my precompiled header. This all works up to a point: for example, NSArray *children = aTopic.orderedChildren; works fine. What doesn't work is defining a class method +keyPathsForValuesAffectingOrderedChildren, which I'd like to use to cause changes in the children relationship to trigger change notifications for orderedChildren. keyPathsForValuesAffectingOrderedChildren is never called. (Overriding keyPathsForValuesAffectingValueForKey: from a category is verboten.) All this works on a category-implemented, transient, optional string attribute on Topic. The only difference is the hackery around UNKNOWN_TYPE, and I'm not sure I understand why that should make a difference. Should I file a bug, or am I off-base? Or is there a better way to wrap CoreData classes? TIA, Doug K; ___ 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
-NSMutableIndexSet shiftIndexesStartingAtIndex:by: weirdness
- shiftIndexesStartingAtIndex:by: and -containsIndexesInRange:NSMakeRange: don't seem to play nicely together.. Is this expected? NSMutableIndexSet *someIndexes = [NSMutableIndexSet indexSet]; [someIndexes addIndex:0]; [someIndexes addIndex:2]; [someIndexes shiftIndexesStartingAtIndex:2 by:-1]; BOOL result1 = [someIndexes containsIndex:0]; BOOL result2 = [someIndexes containsIndex:1]; BOOL result3 = [someIndexes containsIndexesInRange:NSMakeRange(0,2)]; NSLog(@%@ %@ %@, (result1 ? @YES : @NO), (result2 ? @YES : @NO), (result3 ? @YES : @NO) ); -- 2009-09-17 14:21:25.789 otest[19356:10b] YES YES NO thanks ___ 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
[iPhone opengl] drawing issues when switching views
Apologies if this is not on the right list. I have an app with several views, one of which is an OpenGLES view implemented by subclassing OpenGLES2DView. When I switch from a normal view to the OpenGL view it draws the textured sprite as expected, but when I switch from the OpenGL view back to the previous UIKit view, and then back to the OpenGL view the screen is blank, and all I see is the clear colour. The sprite is not drawing. The coordinates for the sprite are the same each time. I can't work out why it draws the first time round and not when I switch back to it the second time. On switching the OpenGL view and controller are both deallocated. The most relevant code is here http://pastie.org/620291. TIA ./Sven ___ 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: #pragma to suppress a warning message
On 9/16/09 11:06 PM, Scott Thompson said: Nonetheless, on the 10.4 machine where I tested this, the method works. Does anybody know what the story is with this method and 10.4? Is this method actually supported by 10.4 or is it something that happens to be supported if certain other software has been installed on a 10.4 platform? If it is not in the headers, it is a private and unsupported method. Generally, but not necessarily. Oftentimes, the Release Notes document the availability of new methods in old OS releases. For example, the 10.6 Foundation Release Notes say: The methods +dateWithTimeInterval:sinceDate: and - initWithTimeIntervalSince1970: have been added to NSDate (NSDate.h). These new methods are available from 10.4 onward. Declarations were not added to the older SDKs, but they are in the 10.6 SDK and properly annotated: - (id)initWithTimeIntervalSince1970:(NSTimeInterval)ti AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; I'm not sure about [NSLocale preferredLanguages] though... -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ 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
NSRunLoop issue
How can I prevent a run loop from returning immediately if there is no input source and no timer attached ? Following problem: I use a separate thread where several periodic timers shall be attached and detached to the thread's run loop. The timers shall be attached and detached (read added and invalidated) across the life of the application. The timers are the only things attached to the run loop, that is, I don't explicitly add any other input sources. Setting and removing the timers is initiated from the main thread - but actually performed in the timer's thread by invoking performSelector:onThread:withObject:waitUntilDone: from the main thread. During the life of the application, or especially at the start, it might happen, that there are no timers active - but timers may be added later on. Now, the docs state, that a run loop will exit immediately when there is no timer and no input source. That is, it might happen that the thread stops immediately after it started. That is, that it is not even possible to have a chance to add a timer, via a method which is actually performed on this thread because the thread did stop far too quickly. My first approach to prevent the thread to stop prematurely is implementing the run method (which is invoked by the thread's main method) like this: - (void) run { BOOL processedInputSource; while (!self.stopped) { processedInputSource = [runLoop runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]); } } That is, the life of the thread will be controlled by an ivar namely stopped. It is initially set to to NO, and only set to YES via a method -stop that is scheduled in this thread via performSelector:onThread:withObject:waitUntilDone:. The good thing with this approach is, that it is quite easy to remove and add timers and it is also very easy, to explicitly stop the thread when it is required without facing synchronization issues. It works perfectly as long there is a timer (or an input source), since the run loop will block then and not causing a busy loop. However, when there is no timer attached (and no other input source), it causes a the run loop to not block, that is, returning quickly, which in turn forces the CPU to do elaborately effectively nothing. How can I prevent the busy loop, or achieve my goals with a better design? Thanks in advance for ideas. Regards 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
Re: Catch exception in NSArrayController
On 9/17/09 1:26 PM, Konrad Windszus said: I have a classical binding usecase: A NSArrayController is used for displaying the columns of a NSTableView. The columns itself therefore use the arrangedObject method of the NSArrayController. In the get methods of the model itself (which normally return an NSString* which should be displayed in the column), there could occur an exception. I want to catch that exception in the NSArrayController. I therefore subclassed the NSArrayController and overwrote valueForKeyPath with a simple: - (id)valueForKeyPath:(NSString *)keyPath { try { [super valueForKeyPath:keyPath]; } catch (...) { // want to get here, if there is an exception thrown within the model class } } Unfortunately it is only called with arrangedObjects. At that point no exception is thrown yet. Somewhere after that a valueForKeyPath must be executed on that returned arrangedObjects. Since I have not subclassed this proxy class, I cannot intercept its valueForKeyPath method and therefore cannot catch the exception. Is there a simple way to catch exceptions in the controller class which is thrown during calling a get method (over binding mechanims)? What's this exception you speak of? Are you throwing or is the system? -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ 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: NSRunLoop issue
Le 17 sept. 2009 à 16:41, Andreas Grosam a écrit : How can I prevent a run loop from returning immediately if there is no input source and no timer attached ? Following problem: I use a separate thread where several periodic timers shall be attached and detached to the thread's run loop. The timers shall be attached and detached (read added and invalidated) across the life of the application. The timers are the only things attached to the run loop, that is, I don't explicitly add any other input sources. Setting and removing the timers is initiated from the main thread - but actually performed in the timer's thread by invoking performSelector:onThread:withObject:waitUntilDone: from the main thread. During the life of the application, or especially at the start, it might happen, that there are no timers active - but timers may be added later on. Now, the docs state, that a run loop will exit immediately when there is no timer and no input source. That is, it might happen that the thread stops immediately after it started. That is, that it is not even possible to have a chance to add a timer, via a method which is actually performed on this thread because the thread did stop far too quickly. My first approach to prevent the thread to stop prematurely is implementing the run method (which is invoked by the thread's main method) like this: - (void) run { BOOL processedInputSource; while (!self.stopped) { processedInputSource = [runLoop runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]); } } That is, the life of the thread will be controlled by an ivar namely stopped. It is initially set to to NO, and only set to YES via a method -stop that is scheduled in this thread via performSelector:onThread:withObject:waitUntilDone:. The good thing with this approach is, that it is quite easy to remove and add timers and it is also very easy, to explicitly stop the thread when it is required without facing synchronization issues. It works perfectly as long there is a timer (or an input source), since the run loop will block then and not causing a busy loop. However, when there is no timer attached (and no other input source), it causes a the run loop to not block, that is, returning quickly, which in turn forces the CPU to do elaborately effectively nothing. How can I prevent the busy loop, or achieve my goals with a better design? Add a dummy source (mach port or timer with an insanely high fire date) before running your loop. So you re sure there is at least one source. -- Jean-Daniel ___ 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: -NSMutableIndexSet shiftIndexesStartingAtIndex:by: weirdness
On 17 sep 2009, at 15.23, steven Hooley wrote: - shiftIndexesStartingAtIndex:by: and -containsIndexesInRange:NSMakeRange: don't seem to play nicely together.. Is this expected? NSMutableIndexSet *someIndexes = [NSMutableIndexSet indexSet]; [someIndexes addIndex:0]; [someIndexes addIndex:2]; [someIndexes shiftIndexesStartingAtIndex:2 by:-1]; BOOL result1 = [someIndexes containsIndex:0]; BOOL result2 = [someIndexes containsIndex:1]; BOOL result3 = [someIndexes containsIndexesInRange:NSMakeRange(0,2)]; Here is the error. You are asking if the index set contains (0,1,2), But it only contains (0, 1) after the shift Try using NSMakeRange (0,1) instead. NSLog(@%@ %@ %@, (result1 ? @YES : @NO), (result2 ? @YES : @NO), (result3 ? @YES : @NO) ); -- 2009-09-17 14:21:25.789 otest[19356:10b] YES YES NO thanks ___ 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/tommy.nordgren%40comhem.se This email sent to tommy.nordg...@comhem.se -- Skinheads are so tired of immigration, that they are going to move to a country that don't accept immigrants! Tommy Nordgren tommy.nordg...@comhem.se ___ 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: -NSMutableIndexSet shiftIndexesStartingAtIndex:by: weirdness
On 17 Sep 2009, at 15:50, Tommy Nordgren wrote: On 17 sep 2009, at 15.23, steven Hooley wrote: - shiftIndexesStartingAtIndex:by: and -containsIndexesInRange:NSMakeRange: don't seem to play nicely together.. Is this expected? NSMutableIndexSet *someIndexes = [NSMutableIndexSet indexSet]; [someIndexes addIndex:0]; [someIndexes addIndex:2]; [someIndexes shiftIndexesStartingAtIndex:2 by:-1]; BOOL result1 = [someIndexes containsIndex:0]; BOOL result2 = [someIndexes containsIndex:1]; BOOL result3 = [someIndexes containsIndexesInRange:NSMakeRange(0,2)]; Here is the error. You are asking if the index set contains (0,1,2), But it only contains (0, 1) after the shift Try using NSMakeRange (0,1) instead. Nonsense ... NSMakeRange(0,2) produces a range starting at 0 with length 2 (ie the values 0 and 1). NSLog(@%@ %@ %@, (result1 ? @YES : @NO), (result2 ? @YES : @NO), (result3 ? @YES : @NO) ); -- 2009-09-17 14:21:25.789 otest[19356:10b] YES YES NO This is a clear demonstration of a bug in NSMutableIndexSet. I can tell you with a fair degree of confidence the cause of the bug too (because I fixed a bug with the same behavior which used to exist in GNUstep): An index set consists of an array of ranges. Code like -containsIndexesInRange: assumes that the ranges are non- adjacent. The -shiftIndexesStartingAtIndex:by: method, in this instance, produces two adjacent ranges and fails to merge them into a single range as it should. ___ 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: -NSMutableIndexSet shiftIndexesStartingAtIndex:by: weirdness
On 17-Sep-2009, at 10:50 PM, Tommy Nordgren wrote: On 17 sep 2009, at 15.23, steven Hooley wrote: - shiftIndexesStartingAtIndex:by: and -containsIndexesInRange:NSMakeRange: don't seem to play nicely together.. Is this expected? NSMutableIndexSet *someIndexes = [NSMutableIndexSet indexSet]; [someIndexes addIndex:0]; [someIndexes addIndex:2]; [someIndexes shiftIndexesStartingAtIndex:2 by:-1]; BOOL result1 = [someIndexes containsIndex:0]; BOOL result2 = [someIndexes containsIndex:1]; BOOL result3 = [someIndexes containsIndexesInRange:NSMakeRange(0,2)]; Here is the error. You are asking if the index set contains (0,1,2), But it only contains (0, 1) after the shift Try using NSMakeRange (0,1) instead. But NSMakeRange takes (index, length) not ( start index, end index ) so the original post seems correct. ___ 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: Catch exception in NSArrayController
Exceptions are used for programmer error in Cocoa. They are not a general error signaling mechanism. There are a few unfortunate exceptions, though: Distributed Objects and Objective-C++. If you are not using these technologies, you should not be throwing or catching exceptions as a control-flow technique. Cocoa isn't, generally speaking, exception-safe. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Catch exception in NSArrayController
I am throwing it myself (or more exactly a c++ library I call within a get method of the model class). But I don't want to handle the exception in the model class, but rather in the controller, which can then disable some UI buttons. Am 17.09.2009 um 16:41 schrieb Sean McBride: On 9/17/09 1:26 PM, Konrad Windszus said: I have a classical binding usecase: A NSArrayController is used for displaying the columns of a NSTableView. The columns itself therefore use the arrangedObject method of the NSArrayController. In the get methods of the model itself (which normally return an NSString* which should be displayed in the column), there could occur an exception. I want to catch that exception in the NSArrayController. I therefore subclassed the NSArrayController and overwrote valueForKeyPath with a simple: - (id)valueForKeyPath:(NSString *)keyPath { try { [super valueForKeyPath:keyPath]; } catch (...) { // want to get here, if there is an exception thrown within the model class } } Unfortunately it is only called with arrangedObjects. At that point no exception is thrown yet. Somewhere after that a valueForKeyPath must be executed on that returned arrangedObjects. Since I have not subclassed this proxy class, I cannot intercept its valueForKeyPath method and therefore cannot catch the exception. Is there a simple way to catch exceptions in the controller class which is thrown during calling a get method (over binding mechanims)? What's this exception you speak of? Are you throwing or is the system? -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ 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: -NSMutableIndexSet shiftIndexesStartingAtIndex:by: weirdness
On Sep 17, 2009, at 6:23 AM, steven Hooley wrote: - shiftIndexesStartingAtIndex:by: and -containsIndexesInRange:NSMakeRange: don't seem to play nicely together.. Is this expected? Please log a bug. bugreporter.apple.com thanks, 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: Send POST data to browser
I'm not sure I understand what you want to do, but here's something that has worked for me and may be what you want: Instead of sending the POST using NSURLConnection, you can write a temporary html file. In this html file, you've inserted an onLoad() javascript which immediately sends the POST, and a button for users that don't have javascript enabled. Now, tell NSWorkspace to open this temporary file. The browser will send the POST, and thus the browser will get back the response. Also, a better forum to discuss this issue would be macnetworkp...@lists.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: Catch exception in NSArrayController
On Sep 17, 2009, at 8:27 AM, Konrad Windszus konra...@gmx.de wrote: I am throwing it myself (or more exactly a c++ library I call within a get method of the model class). But I don't want to handle the exception in the model class, but rather in the controller, which can then disable some UI buttons. This isn't safe. You will need to wrap that class in an Objective-C class that converts the exception into some other means of signifying to the controller layer that it should disable the UI. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: -NSMutableIndexSet shiftIndexesStartingAtIndex:by: weirdness
Done. Refrence 7231673. Thanks all. 2009/9/17 Corbin Dunn corb...@apple.com: On Sep 17, 2009, at 6:23 AM, steven Hooley wrote: - shiftIndexesStartingAtIndex:by: and -containsIndexesInRange:NSMakeRange: don't seem to play nicely together.. Is this expected? Please log a bug. bugreporter.apple.com thanks, 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: How to create subentity object inheriting from superentity object in core data
Thanks, Ben. I hear what you are saying about the draw tool, and, yes, I have played with it extensively. In fact, I fancy myself an ER/ UML/Schema draw tool expert, and I'm afraid, the current Apple draw tool is a nice start, but has a long ways to go before I would consider using it on a serious project. Consequently, I am determined to fully understand the programmatic interface with an eye towards adding some nice core data extension goodies once I get through my study phase. I actually have implemented a data driven population engine that sucks up entity/prop/rel data, builds a model dictionary, and then iterates through it to construct the actual entity model. And, yes, I am setting subentities as well as all the other entity, attr, and rel features. Everything looks good in the mom console printout and xml store file. So my trouble is really on the objc side, I believe. So, going back to my example, (and the part everyone disagrees with!) I still don't get it. More importantly, my objc compiler doesn't get it! In the model, Auto.license is properly inherited by the Sedan and Truck subentities. No trouble at all with KVC interactions. But if there is no @property/@dynamic for license in my Truck subclass, (only in the Auto subclasss) I cannot access thisTruck.license without getting a compiler error. Which makes total sense to me since one NSManagedObject subclass (Truck) is not inheriting from another (Auto) in objc. They each inherit from NSObject. But I CAN do [thisTruck valueForKey:@license], which also makes perfect sense. Sorry for drawing out this thread, but I am intent on becoming a core data expert one of these days and do appreciate the newbie help! - Leon On Sep 16, 2009, at 22:20 , Ben Trumbull wrote: Okay, my understanding, then, is that the inheritance is just in the model - makes sense. If you subclass NSManagedObjects for the parent and child entities, you need to explicitly declare and synthesize (dynamically) all common properties you want to access at lower levels of the hierarchy (at least). entity inheritance is just in the model. class inheritance still applies normally. Just to be clear, in the model I've got Entities: Auto, Sedan, Truck and the parent (Auto) has a common property license. Now when I get a pointer to a Sedan or Truck I want the ability to access via thisTruck.license or thisSedan.license. In fact, if I end up with a pointer (Auto *) thisAuto, I want thisAuto.license as well. To get this to work, without KVC, I need to declare @property/ @dynamic for license in Auto, Sedan and Truck. (Can't just put it in Auto and expect Sedan.license to work). No big deal unless I have a bunch of common properties in the parent entity. No, Objective-C properties are inherited by subclasses. If you use the modeling tools, your model will be created correctly, and your custom NSManagedObject subclasses will have the correct @interface definitions. Even if you need to do all this programmatically, I'd recommend to play with the modeling tools more to see what things are supposed to look like. - Ben ___ 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: NSRunLoop issue
On 2009 Sep 17, at 07:48, Jean-Daniel Dupas wrote: Add a dummy source (mach port or timer with an insanely high fire date) before running your loop. So you re sure there is at least one source. Please show a few lines of code adding a dummy mach port. One time I tried to do that and kept going around in circles in the documentation. Thanks! Jerry Krinock ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to create subentity object inheriting from superentity object in core data
You seem to have mistaken the modeler for a design tool. It's really an implementation tool. There is nothing you can do with Core Data that you can't do with the modeler. There is also nothing you can do with the modeler that you can't do with Core Data (well, besides leave attribute or relationships untyped, but that won't compile). It is much more akin to a source code editor than it is a UML design tool. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: +keyPathsForValuesAffectingKey not working for a category-implemented property on a CoreData class
On Sep 17, 2009, at 05:44, Doug Knowles wrote: In a CoreData entity called Topic, I have a to-many relationship (to other Topics) called children to implement a hierarchy. In a category on Topic, I have implemented a property called orderedChildren which returns a sorted array of the children. In order to ensure that orderedChildren is recognized as a property of the Topic entity, I have defined orderedChildren as an optional, transient attribute of Topic of unknown type (since NSArray or id isn't supported). CoreData generates a property declaration for orderedChildren with type UNKNOWN_TYPE, and I have #defined UNKNOWN_TYPE as id in my precompiled header. It's not at all obvious that following this strategy (creating the transient attribute) does you any good whatsoever. OTOH, it's not at all obvious that it does any harm WRT to the problem you're having. What doesn't work is defining a class method +keyPathsForValuesAffectingOrderedChildren, which I'd like to use to cause changes in the children relationship to trigger change notifications for orderedChildren. keyPathsForValuesAffectingOrderedChildren is never called. (Overriding keyPathsForValuesAffectingValueForKey: from a category is verboten.) Prima facie, the reason 'keyPathsForValuesAffectingOrderedChildren' doesn't get called would be that nothing is observing the property. Maybe that aspect deserves attention ahead of the Core Data side of it. Have you tried writing some debugging code that (a) installs a KVO observer on the orderedChildren property of a Topic object, and (b) changes the children property, to see whether (c) observeValueForKeyPath:... is invoked for key orderedChildren? Narrowing the problem definition might be the most useful thing you could do. Also, sorry if it's a stupid question, but you have checked the console log for exception messages, haven't you? It often happens, with KVO-related problems, that an application can appear to run *almost* correctly after an exception is logged and ignored. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to create subentity object inheriting from superentity object in core data
On Sep 17, 2009, at 09:21, Leon Starr wrote: But if there is no @property/@dynamic for license in my Truck subclass, (only in the Auto subclasss) I cannot access thisTruck.license without getting a compiler error. Which makes total sense to me since one NSManagedObject subclass (Truck) is not inheriting from another (Auto) in objc. They each inherit from NSObject. Nuh uh. If the Objective-C classes are Auto and Truck (which are maybe the same names as your Core Data entities, although they don't *have* to match), then Auto *must* be a subclass of NSManagedObject: @interface Auto : NSManagedObject ... and Truck *must* be a subclass of Auto: @interface Truck : Auto ... That's what Ben meant when he said class inheritance still applies normally. The whole point of the exercise is to make the Objective-C inheritance chain *match* the entity inheritance chain. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to create subentity object inheriting from superentity object in core data
Not yet, anyway ;) But, yes, I agree with you. As it is, Core Data is purely an implementation tool. And from what I can see so far, an excellent one. - Leon On Sep 17, 2009, at 9:38 , Kyle Sluder wrote: You seem to have mistaken the modeler for a design tool. It's really an implementation tool. There is nothing you can do with Core Data that you can't do with the modeler. There is also nothing you can do with the modeler that you can't do with Core Data (well, besides leave attribute or relationships untyped, but that won't compile). It is much more akin to a source code editor than it is a UML design tool. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: settings to build for 10.5 on 10.6?
On Sep 16, 2009, at 7:13 PM, Matt Neuburg wrote: I guess I wasn't clear. Deployment target is 10.5. Base SDK is 10.5. Runs fine on 10.6 but crashes in Core Animation on 10.5. The question is what *else* I need to change to make it run on 10.5. There are no other required build settings. More than likely you are seeing a behavioral difference between 10.6 and 10.5 and we would need to see the code that leads up to this crash to have a chance of understanding what is going wrong. -- 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: How to create subentity object inheriting from superentity object in core data
NOW, I get it. Thanks! Problem solved. (I knew you guys were seeing something I wasn't, so I'm glad I persisted - no pun* intended). - Leon *okay, intended On Sep 17, 2009, at 9:49 , Quincey Morris wrote: On Sep 17, 2009, at 09:21, Leon Starr wrote: But if there is no @property/@dynamic for license in my Truck subclass, (only in the Auto subclasss) I cannot access thisTruck.license without getting a compiler error. Which makes total sense to me since one NSManagedObject subclass (Truck) is not inheriting from another (Auto) in objc. They each inherit from NSObject. Nuh uh. If the Objective-C classes are Auto and Truck (which are maybe the same names as your Core Data entities, although they don't *have* to match), then Auto *must* be a subclass of NSManagedObject: @interface Auto : NSManagedObject ... and Truck *must* be a subclass of Auto: @interface Truck : Auto ... That's what Ben meant when he said class inheritance still applies normally. The whole point of the exercise is to make the Objective- C inheritance chain *match* the entity inheritance chain. ___ 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/leon_starr%40modelint.com This email sent to leon_st...@modelint.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: NSRunLoop issue
Le 17 sept. 2009 à 18:28, Jerry Krinock a écrit : On 2009 Sep 17, at 07:48, Jean-Daniel Dupas wrote: Add a dummy source (mach port or timer with an insanely high fire date) before running your loop. So you re sure there is at least one source. Please show a few lines of code adding a dummy mach port. One time I tried to do that and kept going around in circles in the documentation. [[NSRunLoop currentRunLoop] addPort:[NSMachPort port] forMode:NSDefaultRunLoopMode]; Thanks! Jerry Krinock -- Jean-Daniel ___ 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
Core Data: strange keypath problem
So I am working on a simple Core Data app that can track how much I have made from various apps I sell (right now I just have two iPhone ones I charge for). This is also the app that my Expenses tutorial is based on. I am working on the monthly totals portion again and trying to use fetching for the totals. I have added a 'month' derived attribute to the AppSales entity (yes, I know it should be singular, but I dare not change it now). I have added a text field to the interface that shows the month attribute correctly with bindings. However, when I am in the Application entity's class and do a fetch for all AppSales that have an application of self and a month of x (varies by method, 1-12) I get a keypath not found in entity message in the log. I have tested to make sure that I can in fact fetch AppSales entities based on the Application instance and that part works, I can even NSLog the month of the first item in the array. I must be missing something really simple but have no idea what it is. I have listed relevant code below: From Application.m: - (NSNumber *)janTotal { NSLog(@Application %@: janTotal starting..., self.title); float total = 0.0; // create a fetch request and set it's entity NSFetchRequest *janRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@AppSales inManagedObjectContext:[self managedObjectContext]]; [janRequest setEntity:entity]; // build the predicate and set it NSPredicate *selfPredicate = [NSPredicate predicateWithFormat:@application = %@, self]; NSPredicate *monthPredicate = [NSPredicate predicateWithFormat:@month = %i, 1]; NSPredicate *comboPredicate = [NSCompoundPredicate andPredicateWithSubpredicates:[NSArray arrayWithObjects:selfPredicate, monthPredicate, nil]]; [janRequest setPredicate:comboPredicate]; NSLog(@Application %@: janTotal predicates set., self.title); NSFetchRequest *otherRequest = [[NSFetchRequest alloc] init]; [otherRequest setEntity:entity]; [otherRequest setPredicate:selfPredicate]; NSError *otherError = nil; NSArray *anotherArray = [[self managedObjectContext] executeFetchRequest:otherRequest error:otherError]; NSLog(@anotherArray count = %i, [anotherArray count]); NSLog(@anotherArray firstObject month = %@,[[anotherArray objectAtIndex:1] month]); NSError *anError = nil; NSArray *anArray = [[self managedObjectContext] executeFetchRequest:janRequest error:anError]; NSLog(@Application %@: janTotal [anArray count] = %i, self.title, [anArray count]); // check to see if we got anything if (anError != nil) { NSLog (@fetch error = %@, anError); } if ([anArray count] != 0) { AppSales *value; NSEnumerator *e = [anArray objectEnumerator]; while (value = [e nextObject]) { total = total + [value.total floatValue]; } } [janRequest release]; return [NSNumber numberWithFloat:total]; } Here is the console output: 2009-09-17 12:44:17.659 myAppSales[11094:a0f] Application DMXRef: janTotal starting... 2009-09-17 12:44:17.660 myAppSales[11094:a0f] Application DMXRef: janTotal predicates set. 2009-09-17 12:44:17.662 myAppSales[11094:a0f] anotherArray count = 117 2009-09-17 12:44:17.663 myAppSales[11094:a0f] anotherArray firstObject month = 5 2009-09-17 12:44:17.663 myAppSales[11094:a0f] keypath month not found in entity NSSQLEntity AppSales id=2 Any ideas would be greatly appreciated. Thanks, Mike Swan http://www.michaelsswan.com Change itself is not painful it is resistance to change that causes pain. ___ 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: Core Data: strange keypath problem
On Sep 17, 2009, at 10:00, Michael Swan wrote: So I am working on a simple Core Data app that can track how much I have made from various apps I sell (right now I just have two iPhone ones I charge for). This is also the app that my Expenses tutorial is based on. I am working on the monthly totals portion again and trying to use fetching for the totals. I have added a 'month' derived attribute to the AppSales entity (yes, I know it should be singular, but I dare not change it now). I have added a text field to the interface that shows the month attribute correctly with bindings. However, when I am in the Application entity's class and do a fetch for all AppSales that have an application of self and a month of x (varies by method, 1-12) I get a keypath not found in entity message in the log. I have tested to make sure that I can in fact fetch AppSales entities based on the Application instance and that part works, I can even NSLog the month of the first item in the array. I must be missing something really simple but have no idea what it is. I have listed relevant code below: What do you mean by derived attribute? A transient attribute? That won't work. ___ 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: Send POST data to browser
On Sep 17, 2009, at 3:26 AM, Bartosz Białecki wrote: I can launch browser with url using this code: NSURL *url = [NSURL URLWithString: @https://www.example.com/ index.php]; [[UIApplication sharedApplication] openURL: url]; but I don't know how to send post data. You can't do it — the browser will only do a GET on URLs it's told to open. I tried also another solution: send post data from my application to website and then get a response, but then I don't know how to open returned page in browser. A successful POST will return one of two different things — (1) A redirect to another page. This is a typical HTTP redirect, with a status like 302, 303 or 307 and a Location: header that specifies where to go. In this case you just read the URL from the Location: header and pass that to the browser. (2) An actual page body to display, i.e. a 200 status and a bunch of HTML. This isn't so easy to handle, since you can't give the HTML itself to the browser. The only way you could display it is to open your own UIWebView (in which case it would probably be easier to just open it before the request and use it to send the POST...) If you own the website, then you can make sure that its login page does (1), which is the more correct thing to do anyway. —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: Not receiving mouseDown/Up events in borderless window . . . (Solved!)
Apparently on Leopard (and presumably, early versions of Mac OS X) you have to handle the mouseDown event in order to receive a mouseUp event. Initially, I only overrode mouseUp, thinking that I didn't want to react to the event until the user releases the mouse button inside the NSRect of interest. This little obscure fact didn't appear in any of the texts or web pages I had scanned. I only guessed at the solution when I overrode and observed the behavior of - (void) sendEvent:(NSEvent*)event on both Leopard and Snow Leopard. On Snow Leopard, calling -[super sendEvent:event] was quickly followed by a call to -[mouseUp:event]. On Leopard it is not. -Michael On Sep 14, 2009, at 2:47 PM, Michael A. Crawford wrote: Ok. I went back and did some experimenting and it doesn't look good. First of all the ignoresMouseEvents property was already set to NO. Assuming I had some issue with intercepting mouse clicks at the NSWindow level when an NSView was present, I decided to implement support for event handling in my NSView derived class. Again the code works but only on Snow Leopard. On 10.5 I'm just not seeing those mouse clicks. When I say 'not seeing' I'm talking about empirical evidence. My software doesn't respond by closing the windows or doing anything else I've programmed it to do when the mouse is clicked in one of my views. My tester is reporting the same problem when he runs the code on his 10.5 system. I'm building this code on 10.6 with Xcode 3.2. This is my development machine, which I foolishly upgraded. I no longer have a Leopard development system running Xcode 3.1. How can I see what is going on on my Leopard test system? I'm building using the 10.5 SDK since I want my app to run on both 10.5 and 10.6 as a 32-bit app. With a debug build, is there anyway to see debug console output on my test machine running the binary I build using Xcode 3.2? Obviously this is my problem. If it were the case than anyone processing events in windows and views on 10.5 using a binary built on 10.6 with Xcode 3.2, I would have heard about it. In case you are curious, here is the experimental code. @class CDImageView; @protocol CDImageViewDelegate - (void)mouseUp:(NSEvent*)event onImageView:(CDImageView*)imageView; @end @interface CDImageView : NSImageView { idCDImageViewDelegate delegate; } @property (nonatomic, assign) idCDImageViewDelegate delegate; @end @implementation CDImageView @synthesize delegate; - (void)mouseUp:(NSEvent*)event { [self.delegate mouseUp:event onImageView:self]; } @end -Michael On Sep 12, 2009, at 10:36 PM, Ken Thomases wrote: On Sep 12, 2009, at 9:12 PM, Michael A. Crawford wrote: I have created a borderless window that is used to display a custom graphic, which need to respond to the enter key or a mouse click by closing itself. Seems straightforward enough. It works great on Snow Leopard (10.6) but I do not get the mouse events on Leopard (10.5). Hitting the enter key works on both. Anyone seen this behavior before? I've included the code so you could see if I've left something out. I think you need to setIgnoresMouseEvents:NO. I believe that windows which are transparent below a certain threshold ignore mouse events by default. 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/michaelacrawford%40me.com This email sent to michaelacrawf...@me.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: Send POST data to browser
On Sep 17, 2009, at 12:14 PM, Jens Alfke wrote: On Sep 17, 2009, at 3:26 AM, Bartosz Białecki wrote: I can launch browser with url using this code: NSURL *url = [NSURL URLWithString: @https://www.example.com/index.php ]; [[UIApplication sharedApplication] openURL: url]; but I don't know how to send post data. You can't do it — the browser will only do a GET on URLs it's told to open. I tried also another solution: send post data from my application to website and then get a response, but then I don't know how to open returned page in browser. A successful POST will return one of two different things — (1) A redirect to another page. This is a typical HTTP redirect, with a status like 302, 303 or 307 and a Location: header that specifies where to go. In this case you just read the URL from the Location: header and pass that to the browser. (2) An actual page body to display, i.e. a 200 status and a bunch of HTML. This isn't so easy to handle, since you can't give the HTML itself to the browser. The only way you could display it is to open your own UIWebView (in which case it would probably be easier to just open it before the request and use it to send the POST...) If you own the website, then you can make sure that its login page does (1), which is the more correct thing to do anyway. There's no guarantee that (1) will work, since often this case also includes setting some sort of session cookie (which goes away when the app quits, which, of course, it does when Safari is launched). Even if it sets a persistent cookie, I don't believe that cookies are shared at all between your sand-boxed app and Mobile Safari. (2) is probably the safest bet unless it's for your own website and you can convert the CGI to support GET as well as POST. Glenn Andreas gandr...@gandreas.com http://www.gandreas.com/ wicked fun! Mad, Bad, and Dangerous to Know ___ 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: settings to build for 10.5 on 10.6?
On or about 9/17/09 9:55 AM, thus spake David Duncan david.dun...@apple.com: On Sep 16, 2009, at 7:13 PM, Matt Neuburg wrote: I guess I wasn't clear. Deployment target is 10.5. Base SDK is 10.5. Runs fine on 10.6 but crashes in Core Animation on 10.5. The question is what *else* I need to change to make it run on 10.5. There are no other required build settings. More than likely you are seeing a behavioral difference between 10.6 and 10.5 and we would need to see the code that leads up to this crash to have a chance of understanding what is going wrong. I'm happy to try to reduce this to a simpler case, but before I do that - I thought that setting the deployment target and base sdk to 10.5 meant that there was *no* such difference? In other words, don't these settings mean, give me 10.5 behaviors, even though my development machine happens to be 10.6? If that is not so, then clearly in order to develop *for* 10.5 I should be developing *on* 10.5, not on 10.6 (which would be a pity because I'd lose all the tangy Xcode 3.2 goodness...). 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
Obtaining the application icon
Fellow code monkeys, I'd like to use my application icon in a window and I'd prefer to write something generic and reusable. Is there a simple way of showing the icon in a window? I can see how to get the name of the file from NSBundle and presumably I could manipulate this into an NSImageWell or IKImageView in my window but is there an easier way? Something that could be done in IB rather than coded? Having it look the same as in the about window or Help Viewer would be fine. Cheers, Rev. Andy ___ 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
no mouseDown on dismissing context menu
Hi, If I show a context menu in my view and then click somewhere in the view, mouseDown for the view is not called. Subsequent mouseDragged are triggered. The view returns YES in acceptsFirstMouse and acceptsFirstResponder. What do I miss? Georg ___ 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: Obtaining the application icon
http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSImage_Class/Reference/Reference.html#//apple_ref/doc/uid/2344-imageNamed_ --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: settings to build for 10.5 on 10.6?
Le 17 sept. 2009 à 19:59, Matt Neuburg a écrit : On or about 9/17/09 9:55 AM, thus spake David Duncan david.dun...@apple.com: On Sep 16, 2009, at 7:13 PM, Matt Neuburg wrote: I guess I wasn't clear. Deployment target is 10.5. Base SDK is 10.5. Runs fine on 10.6 but crashes in Core Animation on 10.5. The question is what *else* I need to change to make it run on 10.5. There are no other required build settings. More than likely you are seeing a behavioral difference between 10.6 and 10.5 and we would need to see the code that leads up to this crash to have a chance of understanding what is going wrong. I'm happy to try to reduce this to a simpler case, but before I do that - I thought that setting the deployment target and base sdk to 10.5 meant that there was *no* such difference? In other words, don't these settings mean, give me 10.5 behaviors, even though my development machine happens to be 10.6? Make sure you do a clean build. Sometimes, when you switch build settings and SDKs, Xcode don't recompile all files and it may result is crash like the one you describe. And also, make sure your target really uses the 10.5 SDK (by checking one gcc invocation in the build log). -- Jean-Daniel ___ 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
NSValueTransformer problem with NSTextField update
Greetings- I have written a subclass of NSValueTransformer which converts an NSString from something like 1-1/2 to an NSNumber with a value of 48 for my model to store (converts inches and fractions to number of 32nds). It also does the reverse transformation. This is working perfectly for columns in an NSTableView that I have bound to NSInteger properties in a model object. If I enter: 1 1/2 and press return, it will store the correct number, and it will even instantly update the cell to contain the cleaned up version of the fraction which would be: 1-1/2 (which I find very desirable). So it's like the the transformer is working in the normal direction to store the correct value, then the reverse transformer is also getting called and updating the text cell. So then I had need to use this transformer for a few NSTextFields on the same window as the table and here is the weirdness: When I enter the text (say 1 1/2) and press return, the correct value is getting set in model BUT the field content is not getting updated like it does in the NSTableView. It will select the text, but it will not replace it with its cleaned up content which should be: 1-1/2 If I choose Undo (and also Redo), then the cleaned up text appears. Or if I close the window, and then re-open it, then the cleaned up text is correctly displayed (ditto for the document). Does anyone have any idea why I am seeing this difference between the table columns and the text fields? Is it normal for a transformer to do that nice clean up after return is hit that I am seeing in my table, or is that being caused by some lucky accident in my case? Thank you ___ 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: Obtaining the application icon
An other way is to use - [NSApplication applicationIconImage] Le 17 sept. 2009 à 20:06, Kyle Sluder a écrit : http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSImage_Class/Reference/Reference.html#//apple_ref/doc/uid/2344-imageNamed_ --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org This email sent to devli...@shadowlab.org -- Jean-Daniel ___ 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: settings to build for 10.5 on 10.6?
On Sep 17, 2009, at 10:59 AM, Matt Neuburg wrote: I'm happy to try to reduce this to a simpler case, but before I do that - I thought that setting the deployment target and base sdk to 10.5 meant that there was *no* such difference? In other words, don't these settings mean, give me 10.5 behaviors, even though my development machine happens to be 10.6? The answer here depends. You can still target 10.5 and get 10.6 behaviors where these behaviors are additions. For example, on 10.6 you can assign an NSImage to the contents of a layer, regardless of the SDK you build against, but doing so does not work on 10.5. There are linked-on-or-after behaviors that are checked and will cause differences between 10.5 and 10.6 SDKs, but those tend to be for issues where there was a change in behavior between the two OS versions that would break programs. If the changes made were not breaking then it is unlikely that there will be any check to prevent that behavior regardless of your build settings. If that is not so, then clearly in order to develop *for* 10.5 I should be developing *on* 10.5, not on 10.6 (which would be a pity because I'd lose all the tangy Xcode 3.2 goodness...). m. You don't need to develop on 10.5, but you do need to test there to ensure compatibility. -- 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: Obtaining the application icon
On 9/17/09 8:17 PM, Jean-Daniel Dupas said: An other way is to use - [NSApplication applicationIconImage] If your app icon is badged then you probably don't want that icon in your alerts. -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ 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: settings to build for 10.5 on 10.6?
On 9/17/09 11:22 AM, David Duncan said: If that is not so, then clearly in order to develop *for* 10.5 I should be developing *on* 10.5, not on 10.6 (which would be a pity because I'd lose all the tangy Xcode 3.2 goodness...). m. You don't need to develop on 10.5, but you do need to test there to ensure compatibility. And testing there is often easiest when you can build in that environment. More importantly, if you ever need to debug on PPC then you have to use 10.5. So if you continue to target 10.5, it's quite important to be able to build in that environment. Debugging via Rosetta is a pita. -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ 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: settings to build for 10.5 on 10.6?
Le 17 sept. 2009 à 20:22, David Duncan a écrit : On Sep 17, 2009, at 10:59 AM, Matt Neuburg wrote: I'm happy to try to reduce this to a simpler case, but before I do that - I thought that setting the deployment target and base sdk to 10.5 meant that there was *no* such difference? In other words, don't these settings mean, give me 10.5 behaviors, even though my development machine happens to be 10.6? The answer here depends. You can still target 10.5 and get 10.6 behaviors where these behaviors are additions. For example, on 10.6 you can assign an NSImage to the contents of a layer, regardless of the SDK you build against, but doing so does not work on 10.5. There are linked-on-or-after behaviors that are checked and will cause differences between 10.5 and 10.6 SDKs, but those tend to be for issues where there was a change in behavior between the two OS versions that would break programs. If the changes made were not breaking then it is unlikely that there will be any check to prevent that behavior regardless of your build settings. Correct me if I'm wrong, but the linked-on-or-after(10.6) test will returns false if you use the 10.5 SDK on Snow Leopard, isn't it ? If that is not so, then clearly in order to develop *for* 10.5 I should be developing *on* 10.5, not on 10.6 (which would be a pity because I'd lose all the tangy Xcode 3.2 goodness...). m. You don't need to develop on 10.5, but you do need to test there to ensure compatibility. -- David Duncan Apple DTS Animation and Printing -- Jean-Daniel ___ 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: #pragma to suppress a warning message
On Sep 16, 2009, at 6:09 PM, Jay Boyer wrote: Finally, I am doing this because the preferredLanguages method is specified to be an OS 10.5+ method and the project I am working on is being built on the 10.4 SDK. The proper way to set up this project, as you’ve described it, is to build the project using a Base SDK of Mac OS X 10.5 (or later), and a Mac OS X Deployment Target of 10.4. - Base SDK is the latest operating system from which you wish to use features - Deployment Target is the earliest operating system on which your software will run This is the case for both Mac OS X and iPhone OS. You do not need to use the SDK specific to an operating system just because that is the minimum operating system your application will support. — 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: CAAnimation finished ?
On Wed, 16 Sep 2009 19:50:39 -0500, Kevin Cathey cat...@apple.com said: For more, see previous posts on the mailing list. Not so easy; searching Apple's archives doesn't retrieve anything after 2005, which sort of makes the search feature unusable. (And Cocoabuilder has issues of its own.) m. -- matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/ A fool + a tool + an autorelease pool = cool! AppleScript: the Definitive Guide - Second Edition! http://www.tidbits.com/matt/default.html#applescriptthings ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CAAnimation finished ?
On Sep 17, 2009, at 1:44 PM, Matt Neuburg wrote: On Wed, 16 Sep 2009 19:50:39 -0500, Kevin Cathey cat...@apple.com said: For more, see previous posts on the mailing list. Not so easy; searching Apple's archives doesn't retrieve anything after 2005, which sort of makes the search feature unusable. (And Cocoabuilder has issues of its own.) m. I usually use Google with domain lists.apple.com ;-) -Jeff ___ 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: no mouseDown on dismissing context menu
On Sep 17, 2009, at 11:03 AM, Georg Seifert wrote: Hi, If I show a context menu in my view and then click somewhere in the view, mouseDown for the view is not called. Subsequent mouseDragged are triggered. The view returns YES in acceptsFirstMouse and acceptsFirstResponder. What do I miss? Georg___ Hi Georg, This is by design. A click that dismisses a menu should not also trigger whatever was clicked, because it would be easy to accidentally close a window or do something else undesirable. The one (intentional) exception is dragging windows. -Peter ___ 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: settings to build for 10.5 on 10.6?
On Sep 17, 2009, at 11:33 AM, Jean-Daniel Dupas wrote: Correct me if I'm wrong, but the linked-on-or-after(10.6) test will returns false if you use the 10.5 SDK on Snow Leopard, isn't it ? Linked on or after checks should be tied to the specific SDK you use, so if you link against a 10.5 SDK you should appear as if you don't know about 10.6 and should get 10.5 behaviors where necessary. -- 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
Menu shortcuts without modifiers?
Hi, I have an app that contains a QTMovieView. I've set things up so people can use the arrow keys to skip, fast forward, rewind, use space to play/pause etc., as they're used to from other movie-playing apps. Now, I'd like to add menu items that correspond to these actions for people who don't know the shortcuts. I'd also like to show the shortcuts in the menu items, so people know the shortcuts are there. Trouble is: If I set e.g. the space key as a menu item's shortcut and a text field has keyboard focus, the space key goes to the menu, not to the text field. I don't want to disable the menu item, as even if there's a text field with keyboard focus, the user may want to use the menu to pause etc. Is there a way to make any control get the shortcut *before* the menus? Is there a way to disable only the shortcut, but still have it displayed? Is there a way to fake the shortcut, so I can do the actual handling at a different level? (Carbon lets you set the menu shortcut glyph separately from the actual shortcut, for example). Anyone have an idea for a solution? Cheers, -- Uli Kusterer The Witnesses of TeachText are everywhere... http://www.zathras.de ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to create subentity object inheriting from superentity object in core data
On Sep 17, 2009, at 9:21 AM, Leon Starr wrote: So, going back to my example, (and the part everyone disagrees with!) I still don't get it. More importantly, my objc compiler doesn't get it! In the model, Auto.license is properly inherited by the Sedan and Truck subentities. No trouble at all with KVC interactions. But if there is no @property/@dynamic for license in my Truck subclass, (only in the Auto subclasss) I cannot access thisTruck.license without getting a compiler error. Which makes total sense to me since one NSManagedObject subclass (Truck) is not inheriting from another (Auto) in objc. They each inherit from NSObject. But I CAN do [thisTruck valueForKey:@license], which also makes perfect sense. This violates the rule that a subentity must use an Objective-C class that is the same as its superentity, or a subclass of its superentity's Objective-C class. If the Truck entity is a subentity of Auto, then it may reuse the AutoClass, or a TruckClass which must be a subclass of the AutoClass. - Ben ___ 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
Reg: outlineView dataSource method outlineView:child:ofItem:
Hi, I am using outline view to display a set of entities, here my problem is outlineView:child:ofItem: method is getting called more than once for an item of index X of a particular parent. As each call to outlineView:child:ofItem: is returns a new child with different address, in further calls to the outlineView:objectValueForTableColumn:byItem: is still referring to the old address of the child, the app is crashing. Here i am very much unclear why data source is asking for the same item (i.e. the child of index X of a particular parent) more than once? Any help will be greatly appreciated. Thanks, Sravanthi.E ___ 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
Menu item correct size
Hello, I would like to make the text in a menu item bold, while maintaining everything else exactly like in other menu items. Reading and searching I managed to find the appropriate routines to do this, but I seam to have found a big problem. NSFont menuFontOfSize with 0 as the font size doesn't give the correct menu font size, it gives a 13 font size which is smaller then the 14 size of all other menu items. Is there any reliable way to get the right font size? If not, what is the recommended way to do this? Just hardcode 14 to the menu font size? Is this size configurable or does it always stay 14? Or should I just add 1 to the default system font size? Here is the code in Pascal: FontManager := NSFontManager.sharedFontManager; AttrStringFont := NSFont.menuFontOfSize(0); // 0 = default size AttrStringFont.Handle := FontManager.convertFont_toHaveTrait_(AttrStringFont.Handle, NSBoldFontMask); AttrDictionary := NSDictionary.dictionaryWithObject_forKey(AttrStringFont.Handle, objc.id(NSFontAttributeName)); AttrString := NSAttributedString.initWithString_attributes(ItemText, CFDictionaryRef(AttrDictionary.Handle)); if AttrString.Handle nil then Result.setAttributedTitle(AttrString.Handle); thanks, -- Felipe Monteiro de Carvalho ___ 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
iPhone Pref changes
With screen brightness being a big factor in battery life on my iPhone, I find myself frequently swiping over to the Settings app, accessing the Brightness setting, and adjusting it to suit my current setting and the application I'm planning to use. (Using the camera outside on a sunny day vs. reading and writing in SimpleNote in a darkened room, for example.) I'm doing this often enough that it gets a bit annoying and I figured I could build myself a little utility to: a) set the system-wide brightness that will persist when I switch apps. b) set up and save some presets for easy access. Nice little project for a first app, yes? Doing some initial digging through the developer documentation, I've found the Preferences Programming Topics for Core Foundation document and functions like CFPreferencesCopyAppValue and CFPreferencesSetAppValue. I'm not seeing, at first glance, the means of accomplishing my first task. CFPreferencesSetAppValue, for example, specifically says to not pass kCFPreferencesAnyApplication. Is there a security restriction upon accessing the device-wide preferences outside the Settings app? Or am I missing the documentation on accessing and setting them? Thanks in advance for any help! -- Peter Hentges ___ 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
Optimizing Enormous lists in NSBrowser
Hi everyone, I'm recreating a Finder-like column view fro browsing the disk, and I've come up against some optimization impasses. First off, I'm using passive-loading, so that I only load information regarding an item once I get the browser:willDisplayCell: message. This works wonderfully for lazy loading. My problem lies before that. I'm trying to mimic the Finder, so I want to not show hidden files if they're not visible in Finder. When I obtain a directory listing via NSFileManager, it includes everything (including hidden files). Once I get that listing, I filter it based with an isFileVisible = YES predicate, which calls an -[NSString isFileVisible] method I've implemented in a category. This method checks the three standard ways of hiding a file to determine its visibility (prefixed with ., a flipped invisible bit, or listing it in /.hidden [which is deprecated, but I need to support older systems]). Once I've filtered the array, I sort it using a custom compareLikeFinder: method, which sorts items into the same order as they appear in Finder. For normal-sized directories, this works pretty well. However, in my worst-case scenario of a flat directory containing 1 million files, I've found that it takes 34.8 seconds to retrieve a full directory listing (so I know how many to return in browser:numberOfRowsInColumn:), 301.5 seconds to filter the array, and another 73.6 seconds to sort it. Believe it or not, this is actually better than the current implementation, but I'd like to do even better. On that note, here are my questions: 1. How can I obtain a count of files in a directory without retrieving the actual listing of contents? (I can scan through the folder and count by just grabbing catalog infos myself, but is there a faster way?) 2. How can I retrieve the name of the nth item in a directory without retrieving the actual listing of contents? Thanks! Dave DeLong ___ 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: Reg: outlineView dataSource method outlineView:child:ofItem:
It should ask for a particular child just once, but that is an implementation detail. You should always return the same item, and not a new item. It sounds like you expect the outlineview to retain the objects; however, it does not. You have to manage them in an array (or dictionary). corbin On Sep 17, 2009, at 12:26 AM, Sravanthi wrote: Hi, I am using outline view to display a set of entities, here my problem is outlineView:child:ofItem: method is getting called more than once for an item of index X of a particular parent. As each call to outlineView:child:ofItem: is returns a new child with different address, in further calls to the outlineView:objectValueForTableColumn:byItem: is still referring to the old address of the child, the app is crashing. Here i am very much unclear why data source is asking for the same item (i.e. the child of index X of a particular parent) more than once? Any help will be greatly appreciated. Thanks, Sravanthi.E ___ 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: Menu item correct size
On Sep 17, 2009, at 7:17 AM, Felipe Monteiro de Carvalho wrote: Hello, I would like to make the text in a menu item bold, while maintaining everything else exactly like in other menu items. Reading and searching I managed to find the appropriate routines to do this, but I seam to have found a big problem. NSFont menuFontOfSize with 0 as the font size doesn't give the correct menu font size, it gives a 13 font size which is smaller then the 14 size of all other menu items. Is there any reliable way to get the right font size? Hi Felipe, The most reliable way is to ask the menu for its font, via the - [NSMenu font] method. -Peter ___ 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
click on sub-menu's super-item dismisses menu?
say the user say clicks the file menu, the file menu opens then say they hover over recent items and then clicks it (i don't know, out of habit or something) in carbon, this click is ignored, rightfully it seems in cocoa, it dismisses the menu. is there a way i can tell the menu or menu item to NOT dismiss the menu? ___ 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
basic threading question: if parent thread completes
Hi, I need to know this before going in for changes that are too complex. I spawned a thread from AppController (thread1). From thread1, I spawn another thread2. thread1 completes. Will thread2 terminate, give rise to anything else, or just keep on working usually? Wishes, Nick ___ 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: click on sub-menu's super-item dismisses menu?
On Sep 17, 2009, at 3:09 PM, David M. Cotter wrote: say the user say clicks the file menu, the file menu opens then say they hover over recent items and then clicks it (i don't know, out of habit or something) in carbon, this click is ignored, rightfully it seems in cocoa, it dismisses the menu. is there a way i can tell the menu or menu item to NOT dismiss the menu? Hi David, I can't reproduce this behavior in SnowLeopard - the Open Recents menu item does not dismiss the menu when clicked. To answer your question: a menu item with a submenu will ignore clicks if its action is @selector(submenuAction:) or NULL. If the action is something else, then the menu item can be selected. ___ 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: basic threading question: if parent thread completes
On Thu, Sep 17, 2009 at 5:23 PM, Nick Rogers roger...@mac.com wrote: Hi, I need to know this before going in for changes that are too complex. I spawned a thread from AppController (thread1). From thread1, I spawn another thread2. thread1 completes. Will thread2 terminate, give rise to anything else, or just keep on working usually? Continue working; with the exception of the main thread, of course. When the main thread terminates, the program exists, so all other running threads are terminated/canceled/exited/whatever term you want to use. Note if you're using pthreads directly: all threads created should eventually be joined on some thread (doesn't have to be the creator). If you never intend to call pthread_join() on a thread, then call pthread_detach(). ___ 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: click on sub-menu's super-item dismisses menu?
that was a theoretical example, here's a concrete one: in Finder, which we all know is a Cocoa64 app, select a file and go file-open with -- the menu disappears now in XCode (also Cocoa64) go file-open recent -- menu does NOT disappear but thanks, that did the trick On Sep 17, 2009, at 3:26 PM, Peter Ammon wrote: On Sep 17, 2009, at 3:09 PM, David M. Cotter wrote: say the user say clicks the file menu, the file menu opens then say they hover over recent items and then clicks it (i don't know, out of habit or something) in carbon, this click is ignored, rightfully it seems in cocoa, it dismisses the menu. is there a way i can tell the menu or menu item to NOT dismiss the menu? Hi David, I can't reproduce this behavior in SnowLeopard - the Open Recents menu item does not dismiss the menu when clicked. To answer your question: a menu item with a submenu will ignore clicks if its action is @selector(submenuAction:) or NULL. If the action is something else, then the menu item can be selected. ___ 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: [myNSWindow setDocumentEdited:dirtyB] fail ??
i really am stuck on this, i've googled and searched the apple site but can find nothing on this. if anyone has any clue i would be most siked. bouns: free karaoke app for someone who solves this! -dave On Sep 16, 2009, at 10:54 AM, David M. Cotter wrote: when i try to set a breakpoint on setDocumentEdited, the enabled check box shows mixed state, and the breakpoint is never hit. if i try to set it to on it goes back to mixed state so i can't set a breakpoint :( What are the exact steps you use to set the breakpoint? open breakpoints window double click on double click to add symbol paste setDocumentEdited, press return [NSApp mainWindow] always returns nil, so i must use myNSWindow note: i can set this same window's title and the title updates just fine. it's a small palette style window, not the large title bar but the small title bar. -mainWindow only returns NSWindows, not NSPanels. A panel can never be the 'main' window. well i'm not sure you should say never about that. because in our app the main window has a small title bar. in fact all windows have the small title bar. it's still a window, i think, not a panel. ___ 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: click on sub-menu's super-item dismisses menu?
On Thu, Sep 17, 2009 at 3:38 PM, David M. Cotter m...@davecotter.com wrote: in Finder, which we all know is a Cocoa64 app, select a file and go file-open with -- the menu disappears I've noticed this too. File a bug against Finder: http://bugreport.apple.com --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: basic threading question: if parent thread completes
Le 18 sept. 2009 à 00:32, Stephen J. Butler a écrit : On Thu, Sep 17, 2009 at 5:23 PM, Nick Rogers roger...@mac.com wrote: Hi, I need to know this before going in for changes that are too complex. I spawned a thread from AppController (thread1). From thread1, I spawn another thread2. thread1 completes. Will thread2 terminate, give rise to anything else, or just keep on working usually? Continue working; with the exception of the main thread, of course. When the main thread terminates, the program exists, so all other running threads are terminated/canceled/exited/whatever term you want to use. Note that you can terminate the main thread (or any other thread) without affecting other threads by using the pthread_exit() function. Note if you're using pthreads directly: all threads created should eventually be joined on some thread (doesn't have to be the creator). If you never intend to call pthread_join() on a thread, then call pthread_detach(). -- Jean-Daniel ___ 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: [myNSWindow setDocumentEdited:dirtyB] fail ??
On Sep 17, 2009, at 4:39 PM, David M. Cotter wrote: i really am stuck on this, i've googled and searched the apple site but can find nothing on this. if anyone has any clue i would be most siked. bouns: free karaoke app for someone who solves this! -dave On Sep 16, 2009, at 10:54 AM, David M. Cotter wrote: when i try to set a breakpoint on setDocumentEdited, the enabled check box shows mixed state, and the breakpoint is never hit. if i try to set it to on it goes back to mixed state so i can't set a breakpoint :( What are the exact steps you use to set the breakpoint? open breakpoints window double click on double click to add symbol paste setDocumentEdited, press return Perhaps setDocumentEdited: (with the trailing colon)? ___ 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: Shutdown/Restart computer
I use a variation of this... http://developer.apple.com/mac/library/qa/qa2001/qa1134.html On Sep 14, 2009, at 5:59 PM, PCWiz wrote: How would I shut down and restart the computer using Objective-C code? Thanks ___ 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/heizer1%40llnl.gov This email sent to heiz...@llnl.gov -- Charles Heizer Systems Management Solutions Group Lawrence Livermore National Laboratory P: 925-422-0197 smime.p7s Description: S/MIME cryptographic signature ___ 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
[SOLVED] Re: Matching braces and [NSTextView selectionRangeForProposedRange:granularity:];
Using - (void) textViewDidChangeSelection:(NSNotification *) inNotification instead. Works fine. On Sep 14, 2009, at 11:53 PM, Iceberg-Dev wrote: I'm currently trying to match braces in a text editor and intend to use selectionRangeForProposedRange:granularity: for that. While I don't see any problem in finding the matching brace, I'm a bit surprised by the way this method is called repeatedly. So far, I don't see a way to tell a double-click occurred and the mouse was release ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Menu item correct size
Hello, The most reliable way is to ask the menu for its font, via the -[NSMenu font] method. Thanks, but this method was introduced in Mac OS X 10.6 Is there any solution which works in 10.4? -- Felipe Monteiro de Carvalho ___ 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
Bindings and C arrays
Hi All, My question is quite simple, actually. Is there any way to use bindings with C arrays? I have someone else's code I'm working with here, and it uses a BOOL[] array to manage a long array of states. I don't imagine that there's any way to make bindings work with this kind of array, but I thought I'd ask and see if anyone else has had this situation or found a clever solution. If all else fails I'll have to change the code to support bindings. Thanks for any ideas ___ 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 and C arrays
On Thu, Sep 17, 2009 at 5:20 PM, Chase Meadors c.ed.m...@gmail.com wrote: My question is quite simple, actually. Is there any way to use bindings with C arrays? Since you don't bind to an array, but rather to a property of an object, there's no reason why not. Implement a property with the KVC indexed accessor methods and bind to that property. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Threading and NSPort retain count question
In the Threading Programming Guide, I'm trying to understand the discussion of communicating between threads using run loops and NSMachPort objects. (Before someone asks why I'm not looking at an easier way to pass messages between threads: I need to run on Tiger.) I'm confused about a retain count issue. The setup code in the main thread (Listing 3-12) creates a port with [NSMachPort port]. This port is installed on the run loop (does the run loop retain the port?) and then passed to the worker thread. The worker thread function (Listing 3-14, +LaunchThreadWithPort:) takes that port and passes it to a method sendCheckinMessage of a newly created worker object. In sendCheckinMessage (Listing 3-15), the worker object retains the port, and uses it as a send port for a message. Now here's the part that confuses me: When control returns to Listing 3-14, the port gets released. Why? This class method didn't retain or create the port, so it shouldn't be releasing it, no? -- James W. Walker, Innoventive Software LLC http://www.frameforge3d.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: [myNSWindow setDocumentEdited:dirtyB] fail ??
okay i can set a breakpoint now it always breaks when i am setting it to YES but never breaks any other time. ie: the document is definitely being set to edited, and NEVER being set to not edited but the red dot never draws in the window are there any kind of window classes / types / styles for which there IS NO red dot in the close window widget? even if you set it to have one? inline: Screen shot 2009-09-17 at 6.15.29 PM.png On Sep 17, 2009, at 3:47 PM, Randall Meadows wrote: On Sep 17, 2009, at 4:39 PM, David M. Cotter wrote: i really am stuck on this, i've googled and searched the apple site but can find nothing on this. if anyone has any clue i would be most siked. bouns: free karaoke app for someone who solves this! -dave On Sep 16, 2009, at 10:54 AM, David M. Cotter wrote: when i try to set a breakpoint on setDocumentEdited, the enabled check box shows mixed state, and the breakpoint is never hit. if i try to set it to on it goes back to mixed state so i can't set a breakpoint :( What are the exact steps you use to set the breakpoint? open breakpoints window double click on double click to add symbol paste setDocumentEdited, press return Perhaps setDocumentEdited: (with the trailing colon)? ___ 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: Menu item correct size
Thanks a lot. That's what I imagined, but I wanted some confirmation =) -- Felipe Monteiro de Carvalho ___ 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
Finding user's Music folder (and others)?
I need to find the iTunes Music Library.xml file, which I know to be in the iTunes music folder under the iTunes directory. Is there an API call to get the user's Music folder? I realize iTunes allows you to specify another location for the music folder, so perhaps I need to ask iTunes for it directly, but for the time being finding the Music folder is a good start. Generally speaking, how do I find the special user directories? I know about NSHomeDirectory(). Searching Google and the docs for things like find folder special directories fsfindfolder turned up a ton of pretty useless stuff. TIA, Rick ___ 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: SOLVED Finding user's Music folder (and others)?
Sigh, sorry. I looked at NSSearchPathForDirectoriesInDomains() and dismissed it without looking more closely. That's what I needed. Sorry for the noise. On Sep 17, 2009, at 18:52:28, Rick Mann wrote: I need to find the iTunes Music Library.xml file, which I know to be in the iTunes music folder under the iTunes directory. Is there an API call to get the user's Music folder? I realize iTunes allows you to specify another location for the music folder, so perhaps I need to ask iTunes for it directly, but for the time being finding the Music folder is a good start. Generally speaking, how do I find the special user directories? I know about NSHomeDirectory(). Searching Google and the docs for things like find folder special directories fsfindfolder turned up a ton of pretty useless stuff. TIA, Rick ___ 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/rmann%40latencyzero.com This email sent to rm...@latencyzero.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: NSInvocation or NSTimer with an arg
Sounds to me like you might want to rethink your design. You haven't told me what you're trying to achieve with all your timers, but if you're updating some value in the cell based on its timer, why not have just one timer that updates all the values? If the timer is specific to its very own table view cell, you might not have to worry about cells going out of scope: you could just subclass the UITableViewCell and invalidate the timer in the prepareForReuse method. Best, Hank On Sep 16, 2009, at 10:44 PM, Luther Baker wrote: Thank you Hank that is just what I needed to see. I must've glossed over the docs you reference below. But something just occurred to me with respect to your point regarding UITableViewCells, userinfo and NSIndexPath. If I associate an NSIndexPath* with a timer and I insert 10 timers - each into the top position of a UITableView; then at each insert, all previous NSTimers.userInfo.nsIndexPath values become incorrect. In fact, every timer will have an NSIndexPath with row=0 section=0 if I'm inserting them all into the top. The problem is that userInfo properties will be static while the underlying rows in the table can keep changing. And, if, on insert, a UITableView simply bitblts the cells shifting down ... I'm not sure I'll get a chance to update the timers with their new NSIndexPath? Is there a class or delegate method that gets invoked for every visible cell when the cell's shift down? I need to store something in userInfo that tells me or helps me definitively find the correct Cell to update ... Thanks, -Luther On Wed, Sep 16, 2009 at 8:08 PM, Hank Heijink (Mailinglists) hank.l...@runbox.com wrote: On Sep 16, 2009, at 8:24 PM, Luther Baker wrote: I'd like to fire a simple callback every .1 of second (yes, my stopwatch style app). But in that callback, I need access to a corresponding UITableViewCell. Unfortunately, I don't see a way to choose a selector with a UITableViewCell argument for the oneliner: [NSTimer scheduledTimerWithTimeInterval:#(NSTimeInterval)ti# target:#(id)aTarget# selector:#(SEL)aSelector# userInfo:#(id) userInfo# repeats:#(BOOL)yesOrNo# Yep, that's what the userInfo parameter is for. It's an id, so you can pass your UITableViewCell there, and get it back in the method you pass in the selector argument by calling the -userInfo method on the NSTimer instance (see below). [...snip approach using NSInvocation...] but this approach requires roughly 7 extra lines of code every time I configure a cell for display (creating things like NSMethodSignature, NSInvocation, setters, etc). It isn't enormous but suddenly, my generally small cellForRowAtIndexPath is getting pretty long. I'm wondering if I should be careful. Things like scrolling etc might blast through this and I'd prefer to keep the method fairly light if, there was in fact a way to use the simpler one liner to invoke a callback with an arg. Passing UITableViewCells around is risky business: if the cell scrolls off the screen, you're pointing to a cell in the reuse pool (provided you stick to the standard paradigm), which will most likely lead to trouble, depending on what you're doing. You might be better off passing an NSIndexPath, and then asking for -[UITableView cellForRowAtIndexPath:], which will return nil if the cell is not visible. Again. I certainly appreciate any informal feedback/suggestions. Maybe userInfo would apply for what I'm doing here? I thought userInfo would be stored in the NSTimer and unfortunately, the single callback that everything is firing to doesn't take the NSTimer as an arg so I think that means I'd be tracking NSTimers external to the callback loop ... and I'd just rather avoid that. Are you sure your method has the right signature? If you pass a selector that doesn't accept arguments, everything will work, but see the following from the documentation of NSTimer: The selector must have the following signature: - (void)timerFireMethod:(NSTimer*)theTimer The timer passes itself as the argument to this method. Hope this helps, Hank ___ 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: [myNSWindow setDocumentEdited:dirtyB] fail ??
On 18/09/2009, at 11:37 AM, David M. Cotter wrote: is there such a thing as a normal window that has a very small title bar? Hi David, No, I think you'll need to roll your own. You can get the images for the close button etc by doing something like: [NSWindow standardWindowButton:NSWindowCloseButton forStyleMask: (NSClosableWindowMask|NSUtilityWindowMask)]; but that doesn't jive with what i see here: in the Carbon version of the very same app, i see this: inline: Screen shot 2009-09-17 at 7.08.04 PM.png___ 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: Core Data: strange keypath problem
Here is the console output: 2009-09-17 12:44:17.659 myAppSales[11094:a0f] Application DMXRef: janTotal starting... 2009-09-17 12:44:17.660 myAppSales[11094:a0f] Application DMXRef: janTotal predicates set. 2009-09-17 12:44:17.662 myAppSales[11094:a0f] anotherArray count = 117 2009-09-17 12:44:17.663 myAppSales[11094:a0f] anotherArray firstObject month = 5 2009-09-17 12:44:17.663 myAppSales[11094:a0f] keypath month not found in entity NSSQLEntity AppSales id=2 Any ideas would be greatly appreciated. Is 'month' marked transient on the AppSales entity in your model ? You cannot ask a *persistent* store to query or sort on *transient* data. - Ben ___ 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: [myNSWindow setDocumentEdited:dirtyB] fail ??
On Thu, Sep 17, 2009 at 7:08 PM, David M. Cotter m...@davecotter.com wrote: in the Carbon version of the very same app, i see this: Why do you want to do this? This is incredibly confusing. Documents don't have small titlebars. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [myNSWindow setDocumentEdited:dirtyB] fail ??
in the Carbon version of the very same app, i see this: Why do you want to do this? This is incredibly confusing. Documents don't have small titlebars. I'm just the engineer tasked with implementing this. Just about all of the Adobe CS5 applications are going to do it this way. they all use a single mini-window to encompass the entire app, which serves as the document, small title bar or not. see: After Effects, Premiere, SoundBooth, Audition etc etc you're not going to get Adobe to turn their ship around. We did it in CS4 for a few apps without issue and nobody was confused, let alone incredibly. If you know how, then please tell me how i can accomplish what i need to accomplish in cocoa, as it obviously can be done (in Carbon) Please, is there a way? thanks and sorry for the confusion. ___ 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
Making a new ICNS file with NSImage
Introduction: I have an actual ICNS file with some nice icon in it. No matter where I draw it within my app, be it a 16x16 square or a 512x512 square, it draws nicely, scales properly, looks crisp at all times. It does this probably (among other things) by using the correct representation within the ICNS file to determine which size in that file it should use to do the actual drawing. So far so good. My problem is this: I want to derive a new icon file (simulated by an NSImage somehow) which has some margins applied to it. The margins on each side should be the size of the area being drawn on divided by 100. So for instance, if we are drawing the icon on a 300x300 area, the top,bottom,left,right margins should all be 3. If drawing on a 30x30 area the margins are .3 or simply negligible. In other words, I somehow want to make an instance of NSImage such that if drawn on a 300x300 rect, it will look slightly smaller than that because of the margins, i.e. it will not fill out the whole rect as the original ICNS would. But also note that this new derived ICNS file (simulated by NSImage) should of course also draw properly when drawn on a, say, 20x20 square. In other words, the new simulated ICNS file (NSImage instance) should also be able to have those original size representations in it somehow that the drawing system can choose from to draw correctly at the requested size. How would you accomplish this? I cannot really make an NSImage, lock focus on it and draw on it beforehand like usual, because I cannot know for sure in the beginning at which size the image will be drawn at. Any ideas? --. _ Windows Live™: Keep your life in sync. Check it out! http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009___ 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: Finding user's Music folder (and others)?
Hmm. I take it back. I can't get code calling NSSearchPathForDirectoriesInDomains() to compile. NSArray* paths = NSSearchPathForDirectoriesInDomains (NSMusicDirectory, NSUserDomainMask, false); error: 'NSMusicDirectory' was not declared in this scope What do I need to do to get NSMusicDirectory? TIA. On Sep 17, 2009, at 19:03:47, Rick Mann wrote: Sigh, sorry. I looked at NSSearchPathForDirectoriesInDomains() and dismissed it without looking more closely. That's what I needed. Sorry for the noise. On Sep 17, 2009, at 18:52:28, Rick Mann wrote: I need to find the iTunes Music Library.xml file, which I know to be in the iTunes music folder under the iTunes directory. Is there an API call to get the user's Music folder? I realize iTunes allows you to specify another location for the music folder, so perhaps I need to ask iTunes for it directly, but for the time being finding the Music folder is a good start. Generally speaking, how do I find the special user directories? I know about NSHomeDirectory(). Searching Google and the docs for things like find folder special directories fsfindfolder turned up a ton of pretty useless stuff. TIA, Rick ___ 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/rmann%40latencyzero.com This email sent to rm...@latencyzero.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/rmann%40latencyzero.com This email sent to rm...@latencyzero.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: [myNSWindow setDocumentEdited:dirtyB] fail ??
On Sep 17, 2009, at 7:46 PM, David M. Cotter m...@davecotter.com wrote: I'm just the engineer tasked with implementing this. Just about all of the Adobe CS5 applications are going to do it this way. they all use a single mini-window to encompass the entire app, which serves as the document, small title bar or not. Wow. That's a travesty. you're not going to get Adobe to turn their ship around. We did it in CS4 for a few apps without issue and nobody was confused, let alone incredibly. Count me among those incredibly confused by the UI changes in the CS3 to CS4 transition. And Apple did yank 64-bit Carbon UI. I don't think telling Adobe that part of that transition means following the HIG is that much of a stretch. If you know how, then please tell me how i can accomplish what i need to accomplish in cocoa, as it obviously can be done (in Carbon) Yes, but there are also other things that can be done in Carbon that are not supported in Cocoa. Please, is there a way? thanks and sorry for the confusion. Well, you could always reimplement the UI widget. Grab the standard close widget and swap its -drawRect: implementation with your own. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Finding user's Music folder (and others)?
On Sep 17, 2009, at 10:03 PM, Rick Mann wrote: Hmm. I take it back. I can't get code calling NSSearchPathForDirectoriesInDomains() to compile. NSArray* paths = NSSearchPathForDirectoriesInDomains (NSMusicDirectory, NSUserDomainMask, false); error: 'NSMusicDirectory' was not declared in this scope What do I need to do to get NSMusicDirectory? Are you building with the 10.6 SDK? NSMusicDirectory is available in 10.6 and later, according to the docs and the header file (NSPathUtilities.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: Finding user's Music folder (and others)?
On Sep 17, 2009, at 20:15:43, Michael Babin wrote: On Sep 17, 2009, at 10:03 PM, Rick Mann wrote: Hmm. I take it back. I can't get code calling NSSearchPathForDirectoriesInDomains() to compile. NSArray* paths = NSSearchPathForDirectoriesInDomains (NSMusicDirectory, NSUserDomainMask, false); error: 'NSMusicDirectory' was not declared in this scope What do I need to do to get NSMusicDirectory? Are you building with the 10.6 SDK? NSMusicDirectory is available in 10.6 and later, according to the docs and the header file (NSPathUtilities.h). Well, I thought I had, but I tried again just to be sure. That's the trick. I just overlooked the line that said 10.6. Thanks! -- Rick ___ 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: Finding user's Music folder (and others)?
On Sep 17, 2009, at 8:18 PM, Rick Mann wrote: On Sep 17, 2009, at 20:15:43, Michael Babin wrote: On Sep 17, 2009, at 10:03 PM, Rick Mann wrote: Hmm. I take it back. I can't get code calling NSSearchPathForDirectoriesInDomains() to compile. NSArray* paths = NSSearchPathForDirectoriesInDomains (NSMusicDirectory, NSUserDomainMask, false); error: 'NSMusicDirectory' was not declared in this scope What do I need to do to get NSMusicDirectory? Are you building with the 10.6 SDK? NSMusicDirectory is available in 10.6 and later, according to the docs and the header file (NSPathUtilities.h). Well, I thought I had, but I tried again just to be sure. That's the trick. I just overlooked the line that said 10.6. Thanks! And if you want to get that path for earlier OS versions, you could use FSFindFolder: NSString* musicFolderPath = nil; FSRef musicFolderRef; if (FSFindFolder(kUserDomain, kMusicDocumentsFolderType, kCreateFolder, musicFolderRef) == noErr) { NSURL* musicFolderURL = [(NSURL*)CFURLCreateFromFSRef(NULL, musicFolderRef) autorelease]; musicFolderPath = [musicFolderURL path]; } ___ 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: [myNSWindow setDocumentEdited:dirtyB] fail ??
On Sep 17, 2009, at 8:03 PM, Kyle Sluder wrote: On Sep 17, 2009, at 7:46 PM, David M. Cotter m...@davecotter.com wrote: you're not going to get Adobe to turn their ship around. We did it in CS4 for a few apps without issue and nobody was confused, let alone incredibly. Count me among those incredibly confused by the UI changes in the CS3 to CS4 transition. I am sorry to hear that - if you want to provide feedback, then feel free to use Adobe User Forums: http://forums.adobe.com/index.jspa You can also use the feature request/bug report form on: https://www.adobe.com/cfusion/mmform/index.cfm?name=wishformsamcap=EWQQLpromoid=EWQQL If you have anything concrete, then go ahead and email me directly (don't cc the list in order to keep the list focused on Cocoa topics). And Apple did yank 64-bit Carbon UI. I don't think telling Adobe that part of that transition means following the HIG is that much of a stretch. There is always a contention between a framework that is easy to use, and a framework that allows for a number of different experiences. Ideally you would have both: - the ability to easily create an application that follows good experience practices - the ability to experiment with features/experiences that work for your particular user segment Cocoa is different than Carbon on these two axis - not worse, and not better, just different. With regards to floating UI, I have had issues where the button highlight on my main window dims when I put focus on a UI panel. This is not how Carbon works, and in my opinion it makes it harder to quickly see which document your floating UI is targeting. We discussed how this would work for our users and decided that they would not like the change. We therefore I ended up using HITheme APIs (these are available in both 32 and 64 bit) and logging enhancement radars. Jesper Storm Bache ___ 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: Making a new ICNS file with NSImage
Hi Squ, I would recommend subclassing NSImageRep to do this. The new rep subclass should retain the original image and draw it slightly inset. It's very similar to subclassing NSView. It looks something like this: @interface MarginalImageRep : NSImageRep { NSImage *_baseImage; CGFloat _margin; } - (id)initWithBaseImage:(NSImage *)baseImage margin:(CGFloat)margin; @property (readonly) NSImage *baseImage; @property (readonly) CGFloat margin; @end @implementation MarginalImageRep - (id)initWithBaseImage:(NSImage *)baseImage margin:(CGFloat)margin { NSParameterAssert(baseImage != nil); self = [super init]; if (self) { { _baseImage = [baseImage retain]; _margin = margin; NSSize sizeIncludingMargin = [baseImage size]; sizeIncludingMargin.width += 2*margin; sizeIncludingMargin.height += 2*margin; [self setSize:sizeIncludingMargin]; } } return self; } -(void)dealloc { [_baseImage release]; [super dealloc]; } - (BOOL)draw { NSRect bounds = (NSRect){NSZeroPoint, [self size]}; [_baseImage drawInRect:NSInsetRect(bounds, _margin, _margin) fromRect: NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; return YES; } - (id)copyWithZone:(NSZone *)zone { MarginalImageRep *rep = [super copyWithZone:zone]; // careful - superclass uses NSCopyObject. rep-_baseImage = [_baseImage retain]; rep-_margin = _margin; return rep; } @synthesize baseImage=_baseImage, margin=_margin; @end We covered this technique in the WWDC 2009 talk about NSImage. If you have access, I'd recommend watching the presentation when it comes out. It explains some of the choices here. You'd use the image like this: MarginalImageRep *marginalRep = [[[MarginalImageRep alloc] initWithBaseImage:baseImage margin:20] autorelease]; NSImage *marginalImage = [[[NSImage alloc] initWithSize:[marginalRep size]] autorelease]; [marginalImage addRepresentation:marginalRep]; // it's a waste of resources to cache here, because the baes image can maintain its own cache. [marginalImage setCacheMode:NSImageCacheNever]; -Ken On Thu, Sep 17, 2009 at 7:39 PM, Squ Aire squ...@live.com wrote: Introduction: I have an actual ICNS file with some nice icon in it. No matter where I draw it within my app, be it a 16x16 square or a 512x512 square, it draws nicely, scales properly, looks crisp at all times. It does this probably (among other things) by using the correct representation within the ICNS file to determine which size in that file it should use to do the actual drawing. So far so good. My problem is this: I want to derive a new icon file (simulated by an NSImage somehow) which has some margins applied to it. The margins on each side should be the size of the area being drawn on divided by 100. So for instance, if we are drawing the icon on a 300x300 area, the top,bottom,left,right margins should all be 3. If drawing on a 30x30 area the margins are .3 or simply negligible. In other words, I somehow want to make an instance of NSImage such that if drawn on a 300x300 rect, it will look slightly smaller than that because of the margins, i.e. it will not fill out the whole rect as the original ICNS would. But also note that this new derived ICNS file (simulated by NSImage) should of course also draw properly when drawn on a, say, 20x20 square. In other words, the new simulated ICNS file (NSImage instance) should also be able to have those original size representations in it somehow that the drawing system can choose from to draw correctly at the requested size. How would you accomplish this? I cannot really make an NSImage, lock focus on it and draw on it beforehand like usual, because I cannot know for sure in the beginning at which size the image will be drawn at. Any ideas? --. _ Windows Live™: Keep your life in sync. Check it out! http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com This email sent to kenfe...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: Finding user's Music folder (and others)?
On 18/09/2009, at 11:52 AM, Rick Mann wrote: I realize iTunes allows you to specify another location for the music folder, so perhaps I need to ask iTunes for it directly, but for the time being finding the Music folder is a good start. It's also pretty common to relocate it - don't assume it's unusual. Quite a few people like to keep their music on an external drive so whatever it is you're doing, if you assume ~/Music/, it'll fail in those cases, as you realise. Probably better to work out how to obtain iTunes setting - maybe by peeking at its prefs. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [myNSWindow setDocumentEdited:dirtyB] fail ??
On Sep 17, 2009, at 9:15 PM, Jesper Storm Bache jsba...@adobe.com wrote: With regards to floating UI, I have had issues where the button highlight on my main window dims when I put focus on a UI panel. This is not how Carbon works, and in my opinion it makes it harder to quickly see which document your floating UI is targeting. This is the key vs main distinction that has been in the OS for a long time. I believe the 10.6 release notes address this. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Finding user's Music folder (and others)?
For sure, and we will be. I suspect one can ask iTunes via an AppleEvent, but looking at the prefs is not a bad suggestion. I just needed a reasonable solution that was easy to get to in the meantime. Thanks. On Sep 17, 2009, at 21:32:00, Graham Cox wrote: On 18/09/2009, at 11:52 AM, Rick Mann wrote: I realize iTunes allows you to specify another location for the music folder, so perhaps I need to ask iTunes for it directly, but for the time being finding the Music folder is a good start. It's also pretty common to relocate it - don't assume it's unusual. Quite a few people like to keep their music on an external drive so whatever it is you're doing, if you assume ~/Music/, it'll fail in those cases, as you realise. Probably better to work out how to obtain iTunes setting - maybe by peeking at its prefs. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSString vs. encoding
On 16 Sep 2009, at 22:55, Johan Kool wrote: Thanks so much!! That is indeed the case! I now use strunvis and it's all done in just 4 lines of code. (Well, except that I should still handle a returned error code.) int len = [stringA lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; char dst[len]; strunvis(dst, [stringA UTF8String]); return [NSString stringWithUTF8String:dst]; Not to burst your bubble, but that doesn't look quite right. It fails in the case where stringA contains no escaped characters (including the case where it's empty) -- the terminating null byte isn't counted by lengthOfBytesUsingEncoding:, so it ends up writing one byte off the end of dst[]. ___ 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: Making a new ICNS file with NSImage
On 17 Sep 2009, at 19:39, Squ Aire wrote: My problem is this: I want to derive a new icon file (simulated by an NSImage somehow) which has some margins applied to it. The margins on each side should be the size of the area being drawn on divided by 100. So for instance, if we are drawing the icon on a 300x300 area, the top,bottom,left,right margins should all be 3. If drawing on a 30x30 area the margins are .3 or simply negligible. In other words, I somehow want to make an instance of NSImage such that if drawn on a 300x300 rect, it will look slightly smaller than that because of the margins, i.e. it will not fill out the whole rect as the original ICNS would. Correct me if I'm missing something, but can't this be accomplished by simply adding a 10% margin to the original image and scaling that down as necessary? The behavior you're describing is scale-invariant, after all. ___ 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