Re: Right place to unobserve notifications in a document
Am Mo,18.08.2008 um 20:14 schrieb Andy Lee: On Aug 18, 2008, at 12:49 PM, Negm-Awad Amin wrote: Am Mo,18.08.2008 um 18:18 schrieb Andy Lee: -- but in this case I think -dealloc is not only okay, but sometimes the only correct place to unregister a notification. Suppose an invariant of your design is that an object should receive notifications as long as, and only as long as, the object exists. If you unregister too soon, you may have an alive object that fails to get a notification. This is little bit a circular argumentation: I need it the whole lifetime, so i manage it the whole lifetime. Why do you need it until the instance becomes deconstructed? It's only circular in that I specifically selected a class of situations where it makes the most sense. :) I think this is the right pattern: 1. Construct and init the object 2. Let them work (register observations, handling threads, $whatever … ) 3. Stop them 4. Deconstruct them So there are 4 steps, not 2. This pattern is fine and necessary in many cases, but there are also plenty of cases where it is not viable. For example, it may not be clear when the object can stop listening for notifications. It may literally be when all other objects are done with it, i.e., when its retain count goes to zero, and in a dynamic system you may have no way of knowing which will be the last object to release your object. IMO imposing a start-stop paradigm on every class that wants to register interest in notifications -- and engineering every class so that your object can't possibly be released until it is stopped -- is just as much a design error as putting functional work in - dealloc. I would encourage you to reconsider. As I said, in the past I used this pattern very often. And indeed the reason was, that if somebody A is retaining somebody B, A uses B. So I can mix up functional work and memory management. This seems to be convient. If you put it together, you have no possibility of stopping somebody without releasing it. And since you can not be sure, that somebody else holds it, you have to reinstantiate B for a new start. I think in practice a 2-step-pattern makes sharing of the functionality harder! In the cases where you do have a start-stop paradigm, you should put a stop in -dealloc anyway, as Michael argued. You should throw an exception or at least log something, as oberserved objects actually do (dealloc while observation in place or something like this). I think it's okay to unregister in -dealloc because conceptually it's related to releasing your ivars. You're explicitly dissolving a relationship between the object being dealloced and some other object -- a relationship you have to manually manage in the absence of garbage collection. In this case it seems to be ok. Maybe this is the reason for the weak reference. The weak reference is to avoid retain cycles (the same reason why delegates are not retained). We talked about GC. The need for a weak reference using RC is quite clear. With GC turned on, retain cycles are not a problem so you don't have to worry about weak references to self, just as you don't have to bother releasing strong references to ivars. Since the observed object (maybe notification center) will still hold a reference to the observing object, there is a problem. The *observer* will not be freed, if the observed is still living. Obviously you have a problem using GC, for example if you have an observing window and an observed model instance. The model probably lives longer than the window. (Think of info windows …) This seems to be the reason for the weak reference using GC. In the absence of GC, you have to break connections manually, and that's all this is. In fact, you should also break delegate connections to self in the same place, for the same reason. (Hm, I'm not sure whether I'm doing this in my own code -- I'd better check.) You mentioned KVO in another reply. I haven't used KVO, so I'd be interested if anyone has a response to your counterexample. Still waiting … ;--) Cheers, Amin --Andy Amin Negm-Awad [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Question about respondsToSelector
Am Mo,18.08.2008 um 20:17 schrieb Carmen Cerino Jr.: Does the id type have enough information for the respondsToSelector method to work. I have a class with an ivar of type id, and when I invoke the respondsToSelector method it fails when it should succeed. I am assuming it should work fine, because if I skip checking with the respondsToSelector method and just make the call, it executes the method. Can someone please tell me what I am doing wrong? Since the whole dispatch is done by and only by the runtime (exception: messages to super) the rte holds the information. (The compiler only throws warnings, because he can proceed with his work. This is, because he does nothing else than checking!) As others said: a) We need a piece of code b) Typo? Cheers, Amin Thanks, Carmen ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de This email sent to [EMAIL PROTECTED] Amin Negm-Awad [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Deploying project as backward compatible
Hi all, I'm using xcode 3.1. I deployed my project by changing the build configuration to Release. Now this application is working on Leopard. When I try to open the application in Tiger by double clicking it, the application icon appeared in the dock for a moment and suddenly disappeared. The application is not opened and I didn't get any crash log. How can I build application as backward compatible. Thanks in advance. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Shared NSTextView
Hello, Oleg. I am developing a custom view, sort of a simple graphic editor, where the user can draw graphic boxes of different size. Each box should display its own attributed string bounded by its own size, and when the user double-clicks any box, he becomes able to edit the box's text in-place. I think, You can see Sketch example (/Developer/Examples/AppKit/Sketch): they have SKTText and (I don't remember exactly, I don't have Mac at hand now) maybe view for it. They do exactly what you need. -- С уважением, Шкраблюк mailto:[EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: document based app, custom ibaction
I've created a new xcode project, document based cocoa app. Added this code to the mydocument class: m: -(IBAction)getTotals { NSLog(@Hello); } h: -(IBAction)getTotals; I've created a button in the MyDocument.xib, connected through the firstresponder to the getTotals method. Everything compiles ok, but when I push the button nothing happens. Am I missing something somewhere? Some help would very much be appreciated! Op 18 aug 2008, om 19:32 heeft Bart Beulen het volgende geschreven: I've connected a simple button to the First Responder. I was able to select the action that I've created in my MyDocument class. When I run the program and press the button nothing happens. The function was only containing an NSLog statement to check if it worked. Am I missing anything? Op 18 aug 2008, om 19:12 heeft Sherm Pendley het volgende geschreven: On Mon, Aug 18, 2008 at 9:52 AM, Bart Beulen [EMAIL PROTECTED] wrote: However I would like to add a button in my document which is connected to some code, to process the data in the array (etc count up data in columns). I was trying to do this by adding an IBAction function to the MyDocument.h en MyDocument.m files. The problem is that I do not know how to connect the button from my GUI to this action (normally I can ctrl-drag from the button to the object, but I guess this works different for document based apps? Connect it to the First Responder icon in IB. That will route the action message through the responder chain, one element of which is the currently-active document. Details: http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/chapter_2_section_6.html sherm-- -- Cocoa programming in Perl: http://camelbones.sourceforge.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/b2xtreme%40me.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Window controllers, code obfuscation
Hi, I'm trying to decipher someone else's code who is no longer available. He did something that I think I can simplify, but I first want to make sure I'm not being completely wrong-headed about what I'm looking at. He does the following in his MyDocument.m file: - (void)windowControllerDidLoadNib:(NSWindowController *)aController { NSWindow* window = [[[self windowControllers] objectAtIndex:0] window]; [[window windowController] setShouldCascadeWindows:NO]; . . . } In English: He grabs a reference to the array of window controllers from the document object. He grabs the first window controller from that array. He grabs the window from that window controller. He sends a message, setShouldCascadeWindows:NO, to that window's window controller. Unless I'm being completely stupid about this, he could have done this, right? [[[self windowControllers] objectAtIndex:0] setShouldCascadeWindows:NO]; Or better yet, this? [aController setShouldCascadeWindows:NO]; Thanks, -s ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: document based app, custom ibaction
On 19 Aug 2008, at 5:08 pm, Bart wrote: I've created a new xcode project, document based cocoa app. Added this code to the mydocument class: m: -(IBAction)getTotals { NSLog(@Hello); } h: -(IBAction)getTotals; I've created a button in the MyDocument.xib, connected through the firstresponder to the getTotals method. Everything compiles ok, but when I push the button nothing happens. Am I missing something somewhere? Some help would very much be appreciated! IBAction methods must be declared like this: - (IBAction) someActionMethod:(id) sender; since your method doesn't have the right signature, it's not being called. Even if you don't need the sender, your method must be declared as having one. hth, 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 [EMAIL PROTECTED]
Re: Window controllers, code obfuscation
On 19 Aug 2008, at 5:20 pm, Sumner Trammell wrote: Hi, I'm trying to decipher someone else's code who is no longer available. He did something that I think I can simplify, but I first want to make sure I'm not being completely wrong-headed about what I'm looking at. First off, does this person's code not work? If it does, my advice is to leave it alone. Debugged code, no matter how bizarre-looking, is better than any amount of theoretically excellent code that might not work. So, with that out of the way: Or better yet, this? [aController setShouldCascadeWindows:NO]; This seems the most straightforward thing to do. The question you need to answer to your own satisfaction is: Is this what the original coder intended? Is it functionally equivalent to the original code? hth, 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 [EMAIL PROTECTED]
Re: document based app, custom ibaction
Thanks, Again sloppy programming didn't know this could cause problems although the compiler was not worried. I guess I will not make such an error anymore in the future. :o) Op 19 aug 2008, om 09:31 heeft Graham Cox het volgende geschreven: On 19 Aug 2008, at 5:08 pm, Bart wrote: I've created a new xcode project, document based cocoa app. Added this code to the mydocument class: m: -(IBAction)getTotals { NSLog(@Hello); } h: -(IBAction)getTotals; I've created a button in the MyDocument.xib, connected through the firstresponder to the getTotals method. Everything compiles ok, but when I push the button nothing happens. Am I missing something somewhere? Some help would very much be appreciated! IBAction methods must be declared like this: - (IBAction) someActionMethod:(id) sender; since your method doesn't have the right signature, it's not being called. Even if you don't need the sender, your method must be declared as having one. hth, 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 [EMAIL PROTECTED]
Re: NSCalendarDate to be deprecated
As written, 70 microseconds. When I set the calendar's time zone to GMT, the time drops to 43 microseconds. Since my app will only work with dates in GMT, this is a plus. Even so, 40 microseconds is far slower than the 7 - 8 microseconds offered by -[NSCalendarDate dayOfYear]. Unless someone has another offering, I plan to file a bug report on this issue. This calculation is part of an animation loop, so the performance hit is important. Btw, my two offerings return an incorrect 367 for the date 2008-12-31 23:59:59 +; 2008 being a leap year, the correct return is 366. Your offering and NSCalendarDate get it right. int dayOfYearForDate4(NSDate *_date) { NSTimeZone *gmtTimeZone = [NSTimeZone timeZoneForSecondsFromGMT:0]; NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; [calendar setTimeZone:gmtTimeZone]; int day = [calendar ordinalityOfUnit:NSDayCalendarUnit inUnit:NSYearCalendarUnit forDate:_date]; return day; } on 8/18/08 7:34 AM, Eliza Block at [EMAIL PROTECTED] wrote: You could do this: int dayOfYearForDate(NSDate *_date) { NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIndentifier:NSGregorianCalendar]]; int day = [calendar ordinalityOfUnit:NSDayCalendarUnit inUnit:NSYearCalendarUnit forDate:_date]; return day; } I've never benchmarked this, but it's certainly a lot less code. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Hex representation of NSString
Am Mo,18.08.2008 um 19:15 schrieb Charles Srstka: On Aug 18, 2008, at 6:18 AM, Robert Černý wrote: Actually,I'm trying to debug some weird problems with clipboard. My problem is that data copied into clipboard from legacy java application doesn't match data pasted into Cocoa application. I've got data with accented characters which gets converted through MacOS Roman encoding even the visual representation in java is correct. It sounds like you don't really want to use NSString at all. Have you tried just using -[NSPasteboard dataForType:] instead of - [NSPasteboard stringForType:] to get the raw pasteboard data as it's coming from the Java application? Yes, I think, that the other answer tries to solve the problem too late. He should look insinde the pasteboard before a string instance is even in mind. Charles Cheers, Amin Amin Negm-Awad [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: document based app, custom ibaction
Another similar problem. I would like to add a sheet to the button I've created. Normally I would create an IBOutlet and connect the window for the sheet to it, combined with a code to open: [NSApp beginSheet:totalsSheet modalForWindow:[NSApp mainWindow] modalDelegate:self didEndSelector:NULL contextInfo:NULL]; and close it: [NSApp endSheet:totalsSheet]; [totalsSheet orderOut:sender]; However, is this possible when using a mydocument class, because I cannot find any outlets in the interface builder I would also like to create some seperate outlets for displaying some float values from some variables of the mydocument class, this is a similar problems since I don't know where to find the outlets to connect the GUI elements to. At the moment all data is presented in a table using an array controller. This is fine, but I would like to perform some calculations on the same data and present the results in a pop-up window. I guess the method described above should be a nice way to do this. Op 19 aug 2008, om 09:50 heeft Bart Beulen het volgende geschreven: Thanks, Again sloppy programming didn't know this could cause problems although the compiler was not worried. I guess I will not make such an error anymore in the future. :o) Op 19 aug 2008, om 09:31 heeft Graham Cox het volgende geschreven: On 19 Aug 2008, at 5:08 pm, Bart wrote: I've created a new xcode project, document based cocoa app. Added this code to the mydocument class: m: -(IBAction)getTotals { NSLog(@Hello); } h: -(IBAction)getTotals; I've created a button in the MyDocument.xib, connected through the firstresponder to the getTotals method. Everything compiles ok, but when I push the button nothing happens. Am I missing something somewhere? Some help would very much be appreciated! IBAction methods must be declared like this: - (IBAction) someActionMethod:(id) sender; since your method doesn't have the right signature, it's not being called. Even if you don't need the sender, your method must be declared as having one. hth, 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/b2xtreme%40me.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: IKImageBrowser drag reordering question/problem
___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: document based app, custom ibaction
On 19 Aug 2008, at 7:03 pm, Bart wrote: Another similar problem. I would like to add a sheet to the button I've created. Normally I would create an IBOutlet and connect the window for the sheet to it, combined with a code to open: [NSApp beginSheet:totalsSheet modalForWindow:[NSApp mainWindow] modalDelegate:self didEndSelector:NULL contextInfo:NULL]; and close it: [NSApp endSheet:totalsSheet]; [totalsSheet orderOut:sender]; However, is this possible when using a mydocument class, because I cannot find any outlets in the interface builder So, add the outlets you need to the class. It is called *MY*document after all - it's yours ;-) e.g. in MyDocument.h, add the instance variable: IBOutlet id mySheetWindow; and this will show up in IB for you to connect to. (This probably isn't the time to get into handling this in a separate controller class, but you may want to revisit this question when you get the hang of it a bit more). I would also like to create some seperate outlets for displaying some float values from some variables of the mydocument class, this is a similar problems since I don't know where to find the outlets to connect the GUI elements to. Do you really mean outlet? Or just an instance variable? While an outlet is an instance variable, not all instance variables are outlets... Still, in either case, just add them to your class definition as above. At the moment all data is presented in a table using an array controller. This is fine, but I would like to perform some calculations on the same data and present the results in a pop-up window. I guess the method described above should be a nice way to do this. Well, see how you go. Not sure why a separate pop-up window seems such a good idea, but I guess you're just learning the ropes, so go right ahead. hth, 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 [EMAIL PROTECTED]
Re: document based app, custom ibaction
Sorry, didn't know I had to connect the outlets of the mydocument class through file owner This basically solved my problems. Op 19 aug 2008, om 14:03 heeft Graham Cox het volgende geschreven: On 19 Aug 2008, at 7:03 pm, Bart wrote: Another similar problem. I would like to add a sheet to the button I've created. Normally I would create an IBOutlet and connect the window for the sheet to it, combined with a code to open: [NSApp beginSheet:totalsSheet modalForWindow:[NSApp mainWindow] modalDelegate:self didEndSelector:NULL contextInfo:NULL]; and close it: [NSApp endSheet:totalsSheet]; [totalsSheet orderOut:sender]; However, is this possible when using a mydocument class, because I cannot find any outlets in the interface builder So, add the outlets you need to the class. It is called *MY*document after all - it's yours ;-) e.g. in MyDocument.h, add the instance variable: IBOutlet id mySheetWindow; and this will show up in IB for you to connect to. (This probably isn't the time to get into handling this in a separate controller class, but you may want to revisit this question when you get the hang of it a bit more). I would also like to create some seperate outlets for displaying some float values from some variables of the mydocument class, this is a similar problems since I don't know where to find the outlets to connect the GUI elements to. Do you really mean outlet? Or just an instance variable? While an outlet is an instance variable, not all instance variables are outlets... Still, in either case, just add them to your class definition as above. At the moment all data is presented in a table using an array controller. This is fine, but I would like to perform some calculations on the same data and present the results in a pop-up window. I guess the method described above should be a nice way to do this. Well, see how you go. Not sure why a separate pop-up window seems such a good idea, but I guess you're just learning the ropes, so go right ahead. hth, 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/b.beulen%40me.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Window controllers, code obfuscation
--- On Tue, 8/19/08, Sumner Trammell [EMAIL PROTECTED] wrote: Unless I'm being completely stupid about this, he could have done this, right? [[[self windowControllers] objectAtIndex:0] setShouldCascadeWindows:NO]; Or better yet, this? [aController setShouldCascadeWindows:NO]; Unless there's some really odd, ill-advised NSWindow subclass/category at work here, yes. It looks like maybe this method was originally meant to do something different, and the second line just got changed rather than rewriting the first to be more idiomatic. Cheers, Chuck ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Question about respondsToSelector
Sorry about the sketchy details. Basically I have a wrapper class for the Sequence Grabber, and I want to setup a delegate for the decompression callback. This is where I use the respondsToSelector method: static void SGVideoDecompTrackingCallback( void *decompressionTrackingRefCon, OSStatus result, ICMDecompressionTrackingFlags decompressionTrackingFlags, CVPixelBufferRef pixelBuffer, TimeValue64 displayTime, TimeValue64 displayDuration, ICMValidTimeFlags validTimeFlags, void *reserved, void *sourceFrameRefCon ) { #pragma unused(reserved) #pragma unused(sourceFrameRefCon) SGVideo* sgVideoChan = (SGVideo*)decompressionTrackingRefCon; id _delegate = sgVideoChan.delegate; if (result == noErr){ if ([_delegate respondsToSelector: @selector(SGDecompDataProc:)]){ [_delegate SGDecompDataProc:pixelBuffer trackingFlags:decompressionTrackingFlags displayTime:displayTime displayDuration:displayDuration validTimeFlags:validTimeFlags]; } } } Header file where the function I am checking is prototyped: @interface VideoController : NSObject { SeqGrab* mSeqGrab; SGVideo* mVideoChan; IBOutlet SampleCIView* mPreview; } -(void)SGDecompDataProc: (CVPixelBufferRef)pixelBuffer trackingFlags: (ICMDecompressionTrackingFlags)decompressionTrackingFlags displayTime: (TimeValue64)displayTime displayDuration:(TimeValue64)displayDuration validTimeFlags:(ICMValidTimeFlags)validTimeFlags; @end Please let me know if you need to see anything else. Once again I apologize for the sketchy details. Thank you all for your help! Carmen On Aug 18, 2008, at 4:39 PM, Andy Lee wrote: Also: note that method names are case-sensitive, so @selector(doSomething) is not the same as @selector(doSomeThing). Also, if the method you are referring to takes an argument, make sure you aren't forgetting the colon at the end. The name of the method contains all its colons; @selector(doSomething) is different from @selector(doSomething:). --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 [EMAIL PROTECTED]
Re: Question about respondsToSelector
On Tue, Aug 19, 2008 at 2:33 PM, Carmen Cerino Jr. [EMAIL PROTECTED] wrote: Sorry about the sketchy details. Basically I have a wrapper class for the Sequence Grabber, and I want to setup a delegate for the decompression callback. This is where I use the respondsToSelector method: static void SGVideoDecompTrackingCallback( void *decompressionTrackingRefCon, OSStatus result, ICMDecompressionTrackingFlags decompressionTrackingFlags, CVPixelBufferRef pixelBuffer, TimeValue64 displayTime, TimeValue64 displayDuration, ICMValidTimeFlags validTimeFlags, void *reserved, void *sourceFrameRefCon ) { #pragma unused(reserved) #pragma unused(sourceFrameRefCon) SGVideo* sgVideoChan = (SGVideo*)decompressionTrackingRefCon; id _delegate = sgVideoChan.delegate; if (result == noErr){ if ([_delegate respondsToSelector: @selector(SGDecompDataProc:)]){ [_delegate SGDecompDataProc:pixelBuffer trackingFlags:decompressionTrackingFlags displayTime:displayTime displayDuration:displayDuration validTimeFlags:validTimeFlags]; } } } Header file where the function I am checking is prototyped: @interface VideoController : NSObject { SeqGrab* mSeqGrab; SGVideo* mVideoChan; IBOutlet SampleCIView* mPreview; } -(void)SGDecompDataProc: (CVPixelBufferRef)pixelBuffer trackingFlags:(ICMDecompressionTrackingFlags)decompressionTrackingFlags displayTime:(TimeValue64)displayTime displayDuration:(TimeValue64)displayDuration validTimeFlags:(ICMValidTimeFlags)validTimeFlags; @end Please let me know if you need to see anything else. Once again I apologize for the sketchy details. Thank you all for your help! Heya - that's not the entire selector. You want to use : if ([_delegate respondsToSelector: @selector(SGDecompDataProc: trackingFlags: displayTime: displayDuration: validTimeFlags:)]) { ... } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Question about respondsToSelector
*Smacks forehead* Believe it or not I had that originally and it didn't work. I must of had a type-o in the function header that I was passing to respondsToSelector. Thank you all. I am going to go back to making an ass out of myself in the privacy of my own home. Cheers, Carmen On Aug 19, 2008, at 9:55 AM, Jonathan del Strother wrote: GDecompDataProc: trackingFlags: displayTime: displayDuration: validTimeFlags: ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Subclassing NSArrayController?
Hi, I have an ArrayController in IB to manage an array of NSObjects (a custom class) for a TableView. When a new item is inserted via a button connected to insert: a new instance of my class is created and appears in the table. However, I want to be able to control the property values of the new object at the time it is created. So, my class has a property called timeString. The timeString is different for each object and is based on the time showing on a stopwatch (NSTextField) when the object is created. Do I need to subclass NSArrayController and override the insert method in order to deal with getting this value and assigning it to the object at creation or would Key Value Observing in my Controller class be more effective? What is the standard way of doing this? Perhaps there is a way to bind the new object's property to the NSTextField value via IB and still make it so it never changes? Best Regards, Chris Poliquin - [EMAIL PROTECTED] www.chrispoliquin.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 [EMAIL PROTECTED]
Re: Subclassing NSArrayController?
Subclass and override newObject which is declared in NSObjectController.h You can set any properties you like from there. - RONZILLA On Aug 19, 2008, at 7:27 AM, Chris Poliquin [EMAIL PROTECTED] wrote: Hi, I have an ArrayController in IB to manage an array of NSObjects (a custom class) for a TableView. When a new item is inserted via a button connected to insert: a new instance of my class is created and appears in the table. However, I want to be able to control the property values of the new object at the time it is created. So, my class has a property called timeString. The timeString is different for each object and is based on the time showing on a stopwatch (NSTextField) when the object is created. Do I need to subclass NSArrayController and override the insert method in order to deal with getting this value and assigning it to the object at creation or would Key Value Observing in my Controller class be more effective? What is the standard way of doing this? Perhaps there is a way to bind the new object's property to the NSTextField value via IB and still make it so it never changes? Best Regards, Chris Poliquin - [EMAIL PROTECTED] www.chrispoliquin.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/luesang%40apple.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Subclassing NSArrayController?
This is maybe an answer as well as a question. Doesn't the bindings call the init method when creating a class object? Couldn't you just overwrite the init method on your custom class to set any necessary values? Justin Giboney On Aug 19, 2008, at 8:27 AM, Chris Poliquin wrote: Hi, I have an ArrayController in IB to manage an array of NSObjects (a custom class) for a TableView. When a new item is inserted via a button connected to insert: a new instance of my class is created and appears in the table. However, I want to be able to control the property values of the new object at the time it is created. So, my class has a property called timeString. The timeString is different for each object and is based on the time showing on a stopwatch (NSTextField) when the object is created. Do I need to subclass NSArrayController and override the insert method in order to deal with getting this value and assigning it to the object at creation or would Key Value Observing in my Controller class be more effective? What is the standard way of doing this? Perhaps there is a way to bind the new object's property to the NSTextField value via IB and still make it so it never changes? Best Regards, Chris Poliquin - [EMAIL PROTECTED] www.chrispoliquin.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/graphics%40westernbotanicals.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
How to reference a NSDocument from a NSView?
Hi, I'm currently learning Cocoa by reading the 3rd edition of Cocoa Programming for Mac OS X. One of the excercise is to create an application to draw ovals. I ended up with a project like this: DrawView is a subclass of NSView which is responsible to draw the ovals MyDocument is a subclass of NSDocuments which holds a NSMutableArray of ovals + code to load/save the files I then created an IBoutlet theDoc in DrawView.h to reference the instance of MyDocument by connecting the File's Owner. In DrawView, when the user creates an oval (by creating a NSRect with the mouse), it calls [theDoc addOval:oval]. And in its -drawRect:, it asks the doc for an array of ovals to draw them. The application is behaving as expected, the model (the ovals) are kept in MyDocument and the DrawView just draws them. But I was wondering if that was the right Cocoa way to do so, to use an IBOutlet to connect a NSView to a NSDocument. Is there another way to have a reference to the document from one view of the application? regards, jeff -- Jeff Mesnil [EMAIL PROTECTED] http://jmesnil.net/weblog/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: best way to determine if portion of window is visible?
Hey Andy, It's not really the cpu cycles that I'm worried about. It's how quickly a large number of windows closes. I'm fading each window for 1/2 second, in order of appearance. It looks really nice, but there isn't really a need to fade the windows that aren't visible and in fact, causes it to appear as if nothing is happening if a large number of non-exposed windows are faded before the exposed ones are. Jason On Aug 15, 2008, at 5:09 PM, Andy Lee wrote: On Aug 15, 2008, at 2:18 PM, Jason Bobier wrote: I'd like to fade my window out if any portion of it is visible to the user, otherwise I simply want to close it for speed. Is there an easy way to determine if some portion of the window is visible? Offhand I'd say if they can't see it, they can't tell how long it's taking to fade away, and I suspect the few extra CPU cycles used for the fade would be negligible. --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 [EMAIL PROTECTED]
Re: best way to determine if portion of window is visible?
Hi Mike, I'm using an NSViewAnimation to fade the windows, which I suspect uses the alpha channel. A window close is nearly instantaneous, so I'm not worried about the tiny window between when I check to see if the window is exposed and when it closes. Of course, because of the transparency of the covering windows, it is even more difficult to know whether the window is exposed or not. :-) Jason On Aug 15, 2008, at 6:07 PM, Michael Ash wrote: On Fri, Aug 15, 2008 at 2:18 PM, Jason Bobier [EMAIL PROTECTED] wrote: Hey folks, I'd like to fade my window out if any portion of it is visible to the user, otherwise I simply want to close it for speed. Is there an easy way to determine if some portion of the window is visible? If you're fading out the window using setAlphaValue: then it's likely the window server will realize when your window can't be seen anywhere and will be smart enough not to redraw anything, saving you from having to do any work. I don't know if any way to find out for yourself, and indeed it's kind of tough because the user could easily expose your window in between your check and the action you take based on it. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/jbobier%40mac.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Shared NSTextView
On Aug 18, 2008, at 9:46 PM, Oleg Krupnov wrote: I could go the simple and dull way and create a separate instance of NSTextView for each box, but I am afraid this could be a waste of resources, because layout manager is costy. Also, most of time I only need to display text in boxes, not to edit it. Costly is a relative term. Do you have thousands of these boxes, or only dozens? There are optimizations that the Cocoa frameworks themselves will make, because they have to consider the possibility that some application will need them to scale much more than most. That doesn't necessarily mean that your application needs to make the same sorts of optimizations. The controls in the framework share text views via the field editor mechanism, for example, which helps because we have no idea how many controls an app may want to use--furthermore, that mechanism was designed at a time when machines had orders of magnitude less in the way of resources than they do today. If there's an easy and simple way to do things, but you're worried it might be too costly, I'd suggest trying it and using it until measurement shows that it actually is too costly. If you need to optimize, I think that the examples people have mentioned should show how to do it. Douglas Davidson ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Including frameworks in your app bundle
I've been searching, but I can't find the documentation explaining how to include frameworks in your app bundle (third-party frameworks, for example), so that your user does not have to install these frameworks. Could someone point me at the correct documentation/build settings? Thanks. This is probably better for the XCode group, but check out this document: http://developer.apple.com/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/CreatingFrameworks.html It explains what you need to do to embed frameworks in your application. HTH, J As a shortcut to what you need, this website makes it very clear how to embed someone else's framework in your application. http://rentzsch.com/cocoa/embeddedFrameworks Mark ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: How to reference a NSDocument from a NSView?
On Tue, Aug 19, 2008 at 1:37 PM, Jeff Mesnil [EMAIL PROTECTED] wrote: The application is behaving as expected, the model (the ovals) are kept in MyDocument and the DrawView just draws them. But I was wondering if that was the right Cocoa way to do so, to use an IBOutlet to connect a NSView to a NSDocument. Is there another way to have a reference to the document from one view of the application? Answering my own question, my use case is similar to the Sketch example bundled with XCode. In Sketch, they use KVC to observe an NSArrayController. I did the same by calling bind:toObject:withKeyPath:options: in MyDocument windowControllerDidLoadNib: method and it works. To sum up, I've seen 3 different ways to write this code: - use an IBOutlet to reference the NSDocument from a NSView - use [[[self window] windowController] document] from a NSView (thanks Chaitanya!) - forget about the NSDocument and use KVC to directly observe the ovals Using the KVC seems the most natural way to do that in Cocoa. jeff -- Jeff Mesnil [EMAIL PROTECTED] http://jmesnil.net/weblog/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Best Way to Handle Properties?
Hi, I'm new to Cocoa and a little confused about the best way to handle the following: I'm converting a C based application to Object-C/Cocoa. One of the objects is used to hold properties which are loaded from a data file. I have created an object to represent the C Structure as so: @interface PersonDetails : NSObject { NSString* FirstName; NSString* LastName; UInt32 DateOfBirth; UInt32 Height; } (This is a cut down version of the real object). @property(assign,readwrite) NSString* FirstName; @property(assign,readwrite) NSString* LastName; @property(assign,readwrite) UInt32 DateOfBirth; @property(assign,readwrite) UInt32 Height; The implementation second declares these as dynamic (since I may need to massage the data after/before getting/setting the object member). - (NSString*) FirstName ; - (void) setmFirstName :theNewValue; - (NSString*) LastName ; - (void) setLastName :theNewValue; - (UInt32) DateOfBirth ; - (void) DateOfBirth :theNewValue; - (UInt32) Height ; - (void) Height :theNewValue; Here are my questions: 1. The strings are read in from a file into a malloc() buffer and are in a non-standard format. I have a routine that reads strings from the file, converts them to Unicode in the provided buffer. This function is already written (in C) and I'd rather not touch it unless I have to. So I end up with a straight char* buffer containing Unicode characters, I now what to store them in an NSString inside the object, and that's where I'm not sure of the best way of doing it. The outer loop of the code looks like this (in pseudo code): PersonDetails* myPresonDetails; myPresonDetails = [[PersonDetails alloc] init]; while (myCount 0) { //Reads a string from the file and places the size in myStringSize and the unicode data in myBufferPtr ReadPersonString(First,myStringSize,myBufferPtr); // // This is the first bit I am not sure of. // [myPersonDetails setFirstName:[[NSString alloc] initWithCharacters: myBufferPtr length: myStringSize]]; // // Do Stuff with myPersonDetails // // // This is the second bit I am not sure of. // Reset (free) the NSString Buffers // [myPersonDetails Reset]; myCount--; } My specific questions are: Is the NSString allocation and initWithCharacters code the best way to do this? If so, what would the setter look like in this case? If not what is a better way of doing it? in the: [myPersonDetails Reset]; method I was going to release all the strings and zero out the integers. But I was wondering if it would be better to allocate and release the object each time in the while() loop. If I did this, would I need to define a release method in myPersonDetails or would the standard method release the strings for me? Thanks in advance All the Best Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Deploying project as backward compatible
On Aug 19, 2008, at 12:39 AM, [EMAIL PROTECTED] wrote: How can I build application as backward compatible. Usually if an app wouldn't launch, the reason why it wasn't launchable is printed to the system console. Can you open Console.app and tell us the error that gets printed when you try to launch your app on Tiger? Nick Zitzmann http://www.chronosnet.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 [EMAIL PROTECTED]
Re: Best Way to Handle Properties?
On Aug 19, 2008, at 13:02 , Dave wrote: My specific questions are: Is the NSString allocation and initWithCharacters code the best way to do this? If so, what would the setter look like in this case? If not what is a better way of doing it? Hey Dave, I don't think that initWithCharacters is what you want... that expects an array of unichar characters, which isn't what you said you had. Since you're doing the encoding in your other function, and you know what it is, just use the initWithBytes function and the specific encoding. For example (assuming your byte array was in UTF-16BE: char *buf = /* initialized and filled somewhere else */ size_t buf_len = /* set somewhere else */ NSString *myString = [[NSString alloc] initWithBytes:buf length:buf_len encoding:NSUTF16BigEndianStringEncoding]; Just remember, the length is the actual number of bytes (including the 0x00 bytes in the array), not the number of code points or the number of characters. /Jason 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 [EMAIL PROTECTED]
Re: How to reference a NSDocument from a NSView?
On 19-Aug-08, at 12:52 PM, Jeff Mesnil wrote: On Tue, Aug 19, 2008 at 1:37 PM, Jeff Mesnil [EMAIL PROTECTED] wrote: The application is behaving as expected, the model (the ovals) are kept in MyDocument and the DrawView just draws them. But I was wondering if that was the right Cocoa way to do so, to use an IBOutlet to connect a NSView to a NSDocument. Is there another way to have a reference to the document from one view of the application? Answering my own question, my use case is similar to the Sketch example bundled with XCode. In Sketch, they use KVC to observe an NSArrayController. I did the same by calling bind:toObject:withKeyPath:options: in MyDocument windowControllerDidLoadNib: method and it works. To sum up, I've seen 3 different ways to write this code: - use an IBOutlet to reference the NSDocument from a NSView - use [[[self window] windowController] document] from a NSView (thanks Chaitanya!) - forget about the NSDocument and use KVC to directly observe the ovals Using the KVC seems the most natural way to do that in Cocoa. I think all three are actually very valid. although everywhere you've said KVC above needs to e replaced with KVO. :-) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Receiving mouseEnter and mouseExit events.
I'm a little confused on the mouse tracking. I have a view and I want to track when the mouse enters and exits it. If I set setAcceptsMouseMovedEvents to true for my window, (void)mouseMoved: (NSEvent *)theEvent will get called. But, - (void)mouseEntered: (NSEvent *)theEvent and - (void)mouseExited:(NSEvent *)theEvent will not. Am I correct in my understanding that I need to create a NSTrackingArea for these events to get called? thanks for the help Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Receiving mouseEnter and mouseExit events.
On Aug 19, 2008, at 12:04, David Alter wrote: I'm a little confused on the mouse tracking. I have a view and I want to track when the mouse enters and exits it. If I set setAcceptsMouseMovedEvents to true for my window, (void)mouseMoved: (NSEvent *)theEvent will get called. But, - (void)mouseEntered: (NSEvent *)theEvent and - (void)mouseExited:(NSEvent *)theEvent will not. Am I correct in my understanding that I need to create a NSTrackingArea for these events to get called? Yes, create a tracking area, but *don't* setAcceptsMouseMovedEvents:YES. Both mechanisms result in mouseMoved events, but you only want the events produced by the tracking area. (Well, you may not want mouseMoved events at all, just mouseEntered and mouseExited, but you tell the tracking area which of its possible events you want.) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: document based app, custom ibaction
Hey Bart - Understanding the File's Owner is really an essential part of understanding how to use Interface Builder effectively. At the most basic level, all NIBs are loaded at runtime with a call to -[NSBundle loadNibNamed:owner:]. The method takes two arguments, a NIB name which is the NIB file to load, and an owner, which is the object doing the loading. The File's Owner, represented by the blue cube in Interface Builder, is a placeholder object that represents the 'owner' that will be passed in at runtime. The File's Owner is a way for you to refer to objects inside of your NIB file from objects outside of your NIB file. When you load the nib at runtime, the blue cube placeholder in Interface Builder is resolved to the owner object you pass into the NIB loading method, and all of the connects you made to the placeholder are made to the owner you passed in instead. Most NIB files on Mac OS X are loaded for you by various Cocoa classes. NSApplication, NSDocument, NSWindowController, and NSViewController all load nib files for you, and they each pass 'self' in as the parameter to -[NSBundle loadNibNamed:owner:]. This is why your document is represented as the File's Owner for your document NIB. As an exercise, you might try design your sheet in its own NIB file, and then from your MyDocument class, when it's time to show the sheet, invoke -[NSBundle loadNibNamed:owner:], and pass 'self' as the owner. This might help clear up the concept. After you've mastered the File's Owner, the First Responder is the last difficult concept - Jon Hess On Aug 19, 2008, at 6:07 AM, Bart Beulen wrote: Sorry, didn't know I had to connect the outlets of the mydocument class through file owner This basically solved my problems. Op 19 aug 2008, om 14:03 heeft Graham Cox het volgende geschreven: On 19 Aug 2008, at 7:03 pm, Bart wrote: Another similar problem. I would like to add a sheet to the button I've created. Normally I would create an IBOutlet and connect the window for the sheet to it, combined with a code to open: [NSApp beginSheet:totalsSheet modalForWindow:[NSApp mainWindow] modalDelegate:self didEndSelector:NULL contextInfo:NULL]; and close it: [NSApp endSheet:totalsSheet]; [totalsSheet orderOut:sender]; However, is this possible when using a mydocument class, because I cannot find any outlets in the interface builder So, add the outlets you need to the class. It is called *MY*document after all - it's yours ;-) e.g. in MyDocument.h, add the instance variable: IBOutlet id mySheetWindow; and this will show up in IB for you to connect to. (This probably isn't the time to get into handling this in a separate controller class, but you may want to revisit this question when you get the hang of it a bit more). I would also like to create some seperate outlets for displaying some float values from some variables of the mydocument class, this is a similar problems since I don't know where to find the outlets to connect the GUI elements to. Do you really mean outlet? Or just an instance variable? While an outlet is an instance variable, not all instance variables are outlets... Still, in either case, just add them to your class definition as above. At the moment all data is presented in a table using an array controller. This is fine, but I would like to perform some calculations on the same data and present the results in a pop-up window. I guess the method described above should be a nice way to do this. Well, see how you go. Not sure why a separate pop-up window seems such a good idea, but I guess you're just learning the ropes, so go right ahead. hth, 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/b.beulen%40me.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/jhess%40apple.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
NSTableColumn not usable with binder of class NSTextValueBinder?
Hello, When I hit the Delete key in one of my table views, I get the following error logged to the console: Object NSTableColumn: 0x256740 is not usable with binder of class NSTextValueBinder I also don't get the typical Beep that happens when a key press goes off the end of the responder chain. What does this error mean? Have I messed up my bindings somehow? The bindings seem to be working just fine, though. I'm using Xcode 3.1 and the 10.5 SDK. Thanks, -Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Using Flex/Lex in a Cocoa project
On Aug 18, 2008, at 10:57 PM, Michael Ash wrote: Note that depending on what kind of results you want, even if all of your data is within the BMP, this *still* won't save you. As a really basic example, consider a simple, obvious character like é. (That's an e with an acute accent on it if you're having unicode trouble in your e-mail client.) That can be represented as two separate unicode code points, a plain old ASCII e followed by a combining accent mark. If you should happen to split the string on the accent mark, such that the e goes into the first half and the combining accent mark goes into the second half, you get a really unintuitive result. What appears to the user to be a single character gets suddenly blown in two. Worse, if you happen to insert a string in the middle, you could end up applying that acute accent to some *other* letter instead. Sorry, failed to mention that our UTF-16BE data was also normalized to pre-composed Unicode. So this case was handled. You mentioned Korean (which I have yet to play around with), but for another grand 'ol time, try Arabic. You get into something called positional variants. But alas, that's outside the scope of this list. I think the moral of the story here is that when working with Unicode data, it's best to normalize such data and then ensure APIs operating on the data are Unicode savvy. Thankfully, as you've pointed out, the NSString etc. APIs shield folks from much of the gory details. ___ Ricky A. Sharp mailto:[EMAIL PROTECTED] Instant Interactive(tm) http://www.instantinteractive.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSTableColumn not usable with binder of class NSTextValueBinder?
On Aug 19, 2008, at 3:27 PM, Dave Dribin wrote: Hello, When I hit the Delete key in one of my table views, I get the following error logged to the console: Object NSTableColumn: 0x256740 is not usable with binder of class NSTextValueBinder Further information: I have one column with a custom NSCell subclass. However, in IB, this column's cell is an NSTextFieldCell, and I replace the cell in awakeFromNib. I don't see a way to set the column's cell to a direct NSCell subclass in IB. As a test, I changed my custom cell to subclass NSTextFieldCell instead of NSCell and the console error goes away and the Delete key actually deletes the row. But this seems wrong as it's not displaying any text, though. -Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Receiving mouseEnter and mouseExit events.
I just realized that NSTrackingArea is 10.5 and up. I need to support 10.4. mouseEntered and mouseExited have been part of NSResponder from 10.0. To receive these events in 10.4 what should I do? thanks -dave On Aug 19, 2008, at 12:55 PM, Quincey Morris wrote: On Aug 19, 2008, at 12:04, David Alter wrote: I'm a little confused on the mouse tracking. I have a view and I want to track when the mouse enters and exits it. If I set setAcceptsMouseMovedEvents to true for my window, (void)mouseMoved: (NSEvent *)theEvent will get called. But, - (void)mouseEntered: (NSEvent *)theEvent and - (void)mouseExited:(NSEvent *)theEvent will not. Am I correct in my understanding that I need to create a NSTrackingArea for these events to get called? Yes, create a tracking area, but *don't* setAcceptsMouseMovedEvents:YES. Both mechanisms result in mouseMoved events, but you only want the events produced by the tracking area. (Well, you may not want mouseMoved events at all, just mouseEntered and mouseExited, but you tell the tracking area which of its possible events you want.) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/david%40alterconsulting.net This email sent to [EMAIL PROTECTED] www.AlterConsulting.net 510-868-0916 Office 510-435-4391 Mobile ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Receiving mouseEnter and mouseExit events.
Figured it out. I just need to use addTrackingRect:owner:userData:assumeInside enjoy -dave On Aug 19, 2008, at 2:50 PM, David Alter wrote: I just realized that NSTrackingArea is 10.5 and up. I need to support 10.4. mouseEntered and mouseExited have been part of NSResponder from 10.0. To receive these events in 10.4 what should I do? thanks -dave On Aug 19, 2008, at 12:55 PM, Quincey Morris wrote: On Aug 19, 2008, at 12:04, David Alter wrote: I'm a little confused on the mouse tracking. I have a view and I want to track when the mouse enters and exits it. If I set setAcceptsMouseMovedEvents to true for my window, (void)mouseMoved: (NSEvent *)theEvent will get called. But, - (void)mouseEntered: (NSEvent *)theEvent and - (void)mouseExited:(NSEvent *)theEvent will not. Am I correct in my understanding that I need to create a NSTrackingArea for these events to get called? Yes, create a tracking area, but *don't* setAcceptsMouseMovedEvents:YES. Both mechanisms result in mouseMoved events, but you only want the events produced by the tracking area. (Well, you may not want mouseMoved events at all, just mouseEntered and mouseExited, but you tell the tracking area which of its possible events you want.) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/david%40alterconsulting.net This email sent to [EMAIL PROTECTED] www.AlterConsulting.net 510-868-0916 Office 510-435-4391 Mobile ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/david%40alterconsulting.net This email sent to [EMAIL PROTECTED] www.AlterConsulting.net 510-868-0916 Office 510-435-4391 Mobile ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: NSTableColumn not usable with binder of class NSTextValueBinder?
On Aug 19, 2008, at 2:20 PM, Dave Dribin wrote: On Aug 19, 2008, at 3:27 PM, Dave Dribin wrote: Hello, When I hit the Delete key in one of my table views, I get the following error logged to the console: Object NSTableColumn: 0x256740 is not usable with binder of class NSTextValueBinder Further information: I have one column with a custom NSCell subclass. However, in IB, this column's cell is an NSTextFieldCell, and I replace the cell in awakeFromNib. I don't see a way to set the column's cell to a direct NSCell subclass in IB. You can in IB3; just double click on the cell...then set the class. Otherwise, you have to manually set up your binding in code after you set the [tableColumn dataCell]. The binding is specific to the cell type. If you need a code example, I can dig one up. 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 [EMAIL PROTECTED]
From JavaMail to Cocoa?
Dear community, I've developed a Java application using JavaMail library to get my Gmail messages using IMAP. I'd like to switch my code from Java to Cocoa, is there any official Apple Cocoa API for IMAP? Are Mail API published? Thank you, Christophe ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Calling an object from a C function
I have a C function from which I would like to call a method. I can't find any documents the cover how to do this. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: NSTableColumn not usable with binder of class NSTextValueBinder?
On Aug 19, 2008, at 5:19 PM, Corbin Dunn wrote: You can in IB3; just double click on the cell...then set the class. It's not letting me set it to my custom cell. It just beeps (IB version 3.1, build 670). I think this is because the column is setup a text field cell, and it will only let me set the class to an NSTextFieldCell subclass. There's no plain NSCell in the Library from what I can find. Otherwise, you have to manually set up your binding in code after you set the [tableColumn dataCell]. The binding is specific to the cell type. If you need a code example, I can dig one up. Just tried that, too, and now I get the following error in the console (with -NSBindingDebugLogLevel 1): Cocoa Bindings: Error accessing bound property value of object NSTableColumn: 0x256ca0: [NSTableColumn 0x256ca0 valueForUndefinedKey:]: this class is not key value coding-compliant for the key value. Here's my code, which looks very similar to the ManualBindings sample code: [column bind:@value toObject:controller withKeyPath:@arrangedObjects.whatever options:nil]; Again, what's strange is if I change my cell's superclass to be NSTextFieldCell, this bind: call does not give an error and it all works. I also tried subclassing NSActionCell, and that works, too. Is my cell not implementing some method that bindings expects to be there? Something that is implemented in NSActionCell? -Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: From JavaMail to Cocoa?
On 19-Aug-08, at 4:29 PM, Christophe Bismuth wrote: Dear community, I've developed a Java application using JavaMail library to get my Gmail messages using IMAP. I'd like to switch my code from Java to Cocoa, is there any official Apple Cocoa API for IMAP? Are Mail API published? Unfortunately there is no Apple provided Objective-C API for IMAP. I think most developers look at using Pantomime http://www.collaboration-world.com/pantomime The message sending API we had was not very useful and has been deprecated. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Calling an object from a C function
Hi Gilbert. You just have to make sure that your C function is in a .m file (not a .c file) and have the proper header included. Then you just call the method. -Kenny On Aug 19, 2008, at 2:53 PM, Gilbert Mackall wrote: I have a C function from which I would like to call a method. I can't find any documents the cover how to do this. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/kenny_leung%40pobox.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Calling an object from a C function
On Aug 19, 2008, at 2:53 PM, Gilbert Mackall wrote: I have a C function from which I would like to call a method. I can't find any documents the cover how to do this. You call it just like you call any other method. Your C function will need to be compiled with the Obj-C compiler however. Easiest way to do this is to name the source file with a .m extension. -- 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 [EMAIL PROTECTED]
Re: IKImageBrowser drag reordering question/problem
Sorry, mail trashed the content of my email. re-sending it. Hi c. When using IKImageBrowserPathRepresentationType or IKImageBrowserNSURLRepresentationType, ImageKit automatically fill the pasteboard for you for convenience when you start a drag. If you use another representation you will have to fill the pasteboard yourself when the delegate method - (NSUInteger) imageBrowser:(IKImageBrowserView *) aBrowser writeItemsAtIndexes:(NSIndexSet *) itemIndexes toPasteboard: (NSPasteboard *)pasteboard; is invoked. -- Thomas. On Aug 2, 2008, at 7:20 AM, c. mendoza wrote: Hey All, I've successfully managed to use an IKImageBrowser in an app I am developing. My IKImageBrowserItem imageRepresentationType is IKImageBrowserPathRepresentationType, and everything works as advertised: I can drag-reorder and delete the images. However, when I try to use IKImageBrowserNSImageRepresentationType, the images are displayed and I can delete them, but I can no longer drag-reorder them. This is a real pain, because it means that I have to have all of the images I am using in the filesystem, instead of just in memory as NSImages. Now the question, is this a feature or a bug? I should add that I am newbie at Cocoa, and I am very impressed with it so far. thanks, c. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/tgoossens%40mac.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Calling an object from a C function
What is the syntax? For example, how do I invoke the method - (int) myMethod: (int) int; In object myObject from within a C (not Objective C) function and make use of the result? In Objective C I would invoke [myObject myMethod: myInt]; Even better, how do I invoke - (myObject) myMethod: (myObject *) myObjectArg; an make use of the result in a C function? On Aug 19, 2008, at 6:52 PM, David Duncan wrote: On Aug 19, 2008, at 2:53 PM, Gilbert Mackall wrote: I have a C function from which I would like to call a method. I can't find any documents the cover how to do this. You call it just like you call any other method. Your C function will need to be compiled with the Obj-C compiler however. Easiest way to do this is to name the source file with a .m extension. -- 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/3tothe4th%40comcast.net This email sent to [EMAIL PROTECTED] Charlie Dickman [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Calling an object from a C function
On Aug 19, 2008, at 4:28 PM, Charlie Dickman wrote: from within a C (not Objective C) function and make use of the result? In Objective C I would invoke [myObject myMethod: myInt]; You invoke it exactly the same way. There is no difference. But you need to compile as Obj-C. int foo(id bar) { [bar foobaz]; } -- 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 [EMAIL PROTECTED]
Re: Calling an object from a C function
Example: void cFunction(MyObject *myObject) { int myInt; int result; myInt = initializeMyInt(); result = [myObject myMethod:myInt]; printf(result:%i, result); } On Aug 19, 2008, at 4:28 PM, Charlie Dickman wrote: What is the syntax? For example, how do I invoke the method - (int) myMethod: (int) int; In object myObject from within a C (not Objective C) function and make use of the result? In Objective C I would invoke [myObject myMethod: myInt]; Even better, how do I invoke - (myObject) myMethod: (myObject *) myObjectArg; an make use of the result in a C function? On Aug 19, 2008, at 6:52 PM, David Duncan wrote: On Aug 19, 2008, at 2:53 PM, Gilbert Mackall wrote: I have a C function from which I would like to call a method. I can't find any documents the cover how to do this. You call it just like you call any other method. Your C function will need to be compiled with the Obj-C compiler however. Easiest way to do this is to name the source file with a .m extension. -- 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/3tothe4th%40comcast.net This email sent to [EMAIL PROTECTED] Charlie Dickman [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/kenny_leung%40pobox.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Calling an object from a C function
Hi Charlie, The format is like any normal C function. int MyStaticCFunction(int someArg) { //invoke myMethod and return the int the myMethod returns return [objcObject myMethod:someArg]; } You wrote: What is the syntax? For example, how do I invoke the method - (int) myMethod: (int) int; In object myObject from within a C (not Objective C) function and make use of the result? There are no Objective-C functions. Only C functions. There are Objective-C methods. In Objective C I would invoke [myObject myMethod: myInt]; Even better, how do I invoke - (myObject) myMethod: (myObject *) myObjectArg; an make use of the result in a C function? MyObject * MyStaticCFunction(MyObject *myObjectArg) { //assuming MyObject is an Objective C instance [myObjectArg myMethod:myObjectArg]; return myObjectArg; } Hope this helps, Kiel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: NSTableColumn not usable with binder of class NSTextValueBinder?
On Aug 19, 2008, at 3:47 PM, Dave Dribin wrote: On Aug 19, 2008, at 5:19 PM, Corbin Dunn wrote: You can in IB3; just double click on the cell...then set the class. It's not letting me set it to my custom cell. It just beeps (IB version 3.1, build 670). I think this is because the column is setup a text field cell, and it will only let me set the class to an NSTextFieldCell subclass. There's no plain NSCell in the Library from what I can find. Yeah, your correct; please log a bug on this and we will try to fix it. A hacky workaround is to temporarily subclass NSTextFieldCell, then set it in iB, then undo the change. But, the binder will probably be wrong...so that doesn't help you too much. Otherwise, you have to manually set up your binding in code after you set the [tableColumn dataCell]. The binding is specific to the cell type. If you need a code example, I can dig one up. Just tried that, too, and now I get the following error in the console (with -NSBindingDebugLogLevel 1): Cocoa Bindings: Error accessing bound property value of object NSTableColumn: 0x256ca0: [NSTableColumn 0x256ca0 valueForUndefinedKey:]: this class is not key value coding-compliant for the key value. Here's my code, which looks very similar to the ManualBindings sample code: [column bind:@value toObject:controller withKeyPath:@arrangedObjects.whatever options:nil]; Again, what's strange is if I change my cell's superclass to be NSTextFieldCell, this bind: call does not give an error and it all works. I also tried subclassing NSActionCell, and that works, too. Is my cell not implementing some method that bindings expects to be there? Something that is implemented in NSActionCell? I'm not aware of any specific code for it; NSActionCell is a very simple subclass. Maybe the bindings code looks for that class specifically, in order to know when values change. 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 [EMAIL PROTECTED]
Re: Calling an object from a C function
Thanks to all who responded. I must have had a mental block against this. Now, how do I define things like 'self' and 'super' to a C program? On Aug 19, 2008, at 7:38 PM, David Duncan wrote: On Aug 19, 2008, at 4:28 PM, Charlie Dickman wrote: from within a C (not Objective C) function and make use of the result? In Objective C I would invoke [myObject myMethod: myInt]; You invoke it exactly the same way. There is no difference. But you need to compile as Obj-C. int foo(id bar) { [bar foobaz]; } -- David Duncan Apple DTS Animation and Printing Charlie Dickman [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
passing an object between views
Hello, Hopefully this is a generic enough question that it applies to general Cocoa development: How do I pass an object between views? That is: I have an array of objects that I've built using NSXMLParser, and that populates a table, and clicking on a cell changes my view to another table with a separate controller. I had originally thought that I could just write a method, setTableData in the secondary controller, that takes an object as an argument, and then use that object to build the secondary table. This is apparently forbidden by the language, so what's the proper approach? I could make the array available somehow to the new controller, since I can pass the integer index, but I'm not sure how! Thanks, John ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Calling an object from a C function
--- On Tue, 8/19/08, Charlie Dickman [EMAIL PROTECTED] wrote: Now, how do I define things like 'self' and 'super' to a C program? You mean outside of an object? You don't. What would it even mean? There's no concept of selfness in a function. If you want there to be a self, you should create an Objective-C method. Cheers, Chuck ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: passing an object between views
On Aug 19, 2008, at 5:31 PM, John Greene wrote: Hopefully this is a generic enough question that it applies to general Cocoa development: How do I pass an object between views? That is: I have an array of objects that I've built using NSXMLParser, and that populates a table, and clicking on a cell changes my view to another table with a separate controller. I had originally thought that I could just write a method, setTableData in the secondary controller, that takes an object as an argument, and then use that object to build the secondary table. This is apparently forbidden by the language, so what's the proper approach? I could make the array available somehow to the new controller, since I can pass the integer index, but I'm not sure how! It sounds like you might be trying to implement a Master-Detail Interface. Possibly. If so, you might have a look at this: http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Tasks/masterdetail.html j o a r ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Calling an object from a C function
hi charlie give your code or something clearer what are you trying to do? a C object runtime? or a wrapper obj-c to C? (kidding) maybe you could have the right answers, when I read you, my feelings is that you don't go in the right direction On Tue, Aug 19, 2008 at 5:06 PM, Charlie Dickman [EMAIL PROTECTED] wrote: Thanks to all who responded. I must have had a mental block against this. Now, how do I define things like 'self' and 'super' to a C program? On Aug 19, 2008, at 7:38 PM, David Duncan wrote: On Aug 19, 2008, at 4:28 PM, Charlie Dickman wrote: from within a C (not Objective C) function and make use of the result? In Objective C I would invoke [myObject myMethod: myInt]; You invoke it exactly the same way. There is no difference. But you need to compile as Obj-C. int foo(id bar) { [bar foobaz]; } -- David Duncan Apple DTS Animation and Printing Charlie Dickman [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com This email sent to [EMAIL PROTECTED] -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: passing an object between views
On 20 Aug 2008, at 10:31 am, John Greene wrote: I had originally thought that I could just write a method, setTableData in the secondary controller, that takes an object as an argument, and then use that object to build the secondary table. This is apparently forbidden by the language, so what's the proper approach? Can you elaborate on why you think this is forbidden by the language? I can't think of any reason why this wouldn't work conceptually - let's see the code! cheers, 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 [EMAIL PROTECTED]
This document's file has been changed by another application?
I've got a document based app where the document is actually a directory. Every time I save except the first time I get the above error whether or not things have changed, and even if the directory timestamp is unchanged. Under what circumstances does the above message occur and how do I avoid it? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Deploying project as backward compatible
On Mon, Aug 18, 2008 at 11:39 PM, [EMAIL PROTECTED] wrote: Hi all, I'm using xcode 3.1. I deployed my project by changing the build configuration to Release. Now this application is working on Leopard. When I try to open the application in Tiger by double clicking it, the application icon appeared in the dock for a moment and suddenly disappeared. The application is not opened and I didn't get any crash log. How can I build application as backward compatible. http://developer.apple.com/documentation/DeveloperTools/Conceptual/cross_development/index.html ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: This document's file has been changed by another application?
I've got a document based app where the document is actually a directory. Every time I save except the first time I get the above error whether or not things have changed, and even if the directory timestamp is unchanged. Under what circumstances does the above message occur and how do I avoid it? Not sure exactly, but here's a thought: Are you deleting and re- creating the directory each time you save? -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: How to enumerate directory contents?
On Sun, Aug 17, 2008 at 8:39 AM, Nicolas Goles [EMAIL PROTECTED] wrote: Could anyone help me a bit with this ? Type the following in google... enumerate directory contents site:developer.apple.com -Shawn ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
AUTO: Carlos Bermudez is out of the office. (returning 08/25/2008)
I am out of the office until 08/25/2008. I will respond to your message when I return. If you have L3 questions please contact Omar Perez or my manager Clifford Meyers Note: This is an automated response to your message Cocoa-dev Digest, Vol 5, Issue 1484 sent on 8/19/08 5:50:50 PM. This is the only notification you will receive while this person is away. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: This document's file has been changed by another application?
On 20/08/2008, at 11:36 AM, Chris Idou wrote: I've got a document based app where the document is actually a directory. Every time I save except the first time I get the above error whether or not things have changed, and even if the directory timestamp is unchanged. Under what circumstances does the above message occur and how do I avoid it? How are you creating the folder? Are you using the NSDocument - fileWrapperOfType:error: method? -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: This document's file has been changed by another application?
Not sure exactly, but here's a thought: Are you deleting and re- creating the directory each time you save? No. How are you creating the folder? Are you using the NSDocument - fileWrapperOfType:error: method? The directory is pre-existing in this case. I'm not calling that method. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Best Way to Handle Properties?
On Aug 19, 2008, at 10:02 AM, Dave wrote: I'm new to Cocoa and a little confused about the best way to handle the following: I'm converting a C based application to Object-C/Cocoa. One of the objects is used to hold properties which are loaded from a data file. I have created an object to represent the C Structure as so: @interface PersonDetails : NSObject { NSString* FirstName; NSString* LastName; UInt32 DateOfBirth; UInt32 Height; } In Cocoa development, it's best to follow the Cocoa coding conventions. That includes things like naming: Some of Cocoa's dynamic behavior actually leverages the naming conventions, as in Key- Value Coding. Thus you should name these instance variables firstName, lastName, dateOfBirth, and height, respectively. (This is a cut down version of the real object). @property(assign,readwrite) NSString* FirstName; @property(assign,readwrite) NSString* LastName; @property(assign,readwrite) UInt32 DateOfBirth; @property(assign,readwrite) UInt32 Height; These properties should also be named using an initial lower-case letter to fit Cocoa conventions. Furthermore, in general assign is the wrong thing for most object properties (unless they're a parent/peer, like an owner or delegate would be). Even more importantly, for value classes like NSString that have mutable subclasses, you should always use copy instead of retain. The implementation second declares these as dynamic (since I may need to massage the data after/before getting/setting the object member). You don't need to declare the property as @dynamic if you are going to provide an implementation. In fact, you probably WON'T want to declare a property @dynamic in the @implementation block - if you do, you won't get a warning from the compiler if you fail to implement it. - (NSString*) FirstName ; - (void) setmFirstName :theNewValue; - (NSString*) LastName ; - (void) setLastName :theNewValue; - (UInt32) DateOfBirth ; - (void) DateOfBirth :theNewValue; - (UInt32) Height ; - (void) Height :theNewValue; You don't need method declarations in addition to the @property declarations -- those are actually redundant with the @property declarations. Also, the colon is itself part of the method name, you shouldn't separate it like you are above. Is the NSString allocation and initWithCharacters code the best way to do this? If so, what would the setter look like in this case? If not what is a better way of doing it? How to write your custom accessors is addressed well in the Cocoa memory management documentation. Your setters will, in general, always follow one of only a small number of patterns and those are covered in the documentation. -- 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 [EMAIL PROTECTED]
Re: NSTableColumn not usable with binder of class NSTextValueBinder?
On Aug 19, 2008, at 7:03 PM, Corbin Dunn wrote: It's not letting me set it to my custom cell. It just beeps (IB version 3.1, build 670). I think this is because the column is setup a text field cell, and it will only let me set the class to an NSTextFieldCell subclass. There's no plain NSCell in the Library from what I can find. Yeah, your correct; please log a bug on this and we will try to fix it. A hacky workaround is to temporarily subclass NSTextFieldCell, then set it in iB, then undo the change. But, the binder will probably be wrong...so that doesn't help you too much. FYI, I filed this as rdar://problem/6161481. -Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: NSTableColumn not usable with binder of class NSTextValueBinder?
On Aug 19, 2008, at 5:47 PM, Dave Dribin wrote: Again, what's strange is if I change my cell's superclass to be NSTextFieldCell, this bind: call does not give an error and it all works. I also tried subclassing NSActionCell, and that works, too. Is my cell not implementing some method that bindings expects to be there? Something that is implemented in NSActionCell? Well, scratch that. I just tried using NSActionCell again, and I still get the binder warning. I must have messed up my testing the last time around. Looks like it needs to be an NSTextFieldCell. -Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Best Way to Handle Properties?
In addition to what others have said... On Aug 19, 2008, at 12:02 PM, Dave wrote: [myPersonDetails setFirstName:[[NSString alloc] initWithCharacters: myBufferPtr length: myStringSize]]; This makes memory management awkward. This code is creating an object using alloc, so it's responsible for releasing it. However, you're not keeping a pointer to the new string you've created. You're just passing it to the PersonDetails object and then forgetting it. So, you can't release it. There are a few approaches to fixing this. First, you can use a local variable to hold a pointer to the new object. Then, after passing it to setFirstName: you can release it. Second, you can use alloc/init/ autorelease where you currently use alloc/init. Third, you can use a convenience method which creates a string for you but doesn't leave you responsible for releasing it, such as +stringWithCharacters:length:. As noted by others, this requires that the firstName property of PersonDetails be declared (and implemented, if you're not letting the compiler synthesize it) to either retain or copy its value. If the property doesn't do that, then it's failing to make sure the value sticks around as long as it's needed. // // Do Stuff with myPersonDetails // // // This is the second bit I am not sure of. // Reset (free) the NSString Buffers // [myPersonDetails Reset]; myCount--; } My specific questions are: Is the NSString allocation and initWithCharacters code the best way to do this? If so, what would the setter look like in this case? If not what is a better way of doing it? in the: [myPersonDetails Reset]; method I was going to release all the strings and zero out the integers. But I was wondering if it would be better to allocate and release the object each time in the while() loop. If I did this, would I need to define a release method in myPersonDetails or would the standard method release the strings for me? The more normal way to do things is not to use objects as just dumb containers. That is, it's not typical to reset an object and reuse it with completely unrelated content. Your mindset is reflected in the fact that you've named your class PersonDetails rather than, say, Person. You're not conceiving of an object with its own identity and responsibilities. You're just thinking of it as a record or structure for holding some related data together for a brief time. If that's what you need, then go for it, but you needn't bother replacing working C code with an Objective-C class. If you do want to redesign in a more object-oriented fashion, then you should probably initialize a Person object with its most salient details at the time of its creation. For example, does it make sense to ever have a person without a name? If not, then it shouldn't be possible to create one that way. Similarly, it doesn't make sense to reset a Person to have no name. When you're done with a given Person object, you release it. If you need a new one, you allocate and initialize a new one. Lastly, if you need to do something with/to a Person, you should most likely tell the Person object to do it. This is just a guess based on what you've shown above, but I suspect you haven't given your PersonDetails class much smarts about behavior. You probably just have a bunch of code which queries PersonDetails objects for their properties and then does all the work externally to the PersonDetails class. A good guideline to follow is Tell, Don't Ask http://www.pragprog.com/articles/tell-dont-ask (although it's not a hard-and-fast rule, and shouldn't be taken to extremes). Cheers, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Core Data Question 1
I have a Core Data Document-based Application.a document window with a tableview, a text view and a button. When the button is selected, a number is read from the text field and that many objects are programatically added to the tableview. Then a sheet is opened. The tableview presents only part of the attributes of an entity. The sheet will present the remaining attributes in it's own tableview. My problem is that I need the sheetController to have access to the myDocument.h instance variable, NSArrayController *tableController, which is bound to the managedObjectContext. I'm having trouble with this. Is the instance variable of the document available to the sheet? Any ideas? Thanks Rick Tschudin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Application crashing ( Maybe I'm over releasing object? )
Hey guys , I am writing an application to read/write tags to mp3 files... the thing is working out pretty nice , ( my application is able to get a directory input and scan the mp3 files and print the tags in the console ). The problem is that after printing my tags the app crashes and I get an error like : objc[2765]: FREED(id): message release sent to freed object=0x15bf9720 From what I have read, I may be over releasing an object, but I'm not pretty sure at what could I've be doing wrong... here is the piece of code where my app fails. It looks quite long , but it's not really, most of the code is for creating an open dialog window... the app crashes at the end of the last for showing that message ( after writing the mp3 tags in the console )*. *I have read about memory management in cocoa, and I don't really know what's going on here :( , help would be really appreciated. Thanks! * -(IBAction)scanAlbums:(id)sender* { int totalFiles; *// Loop counter.* int j=0; *// Another loop counter* * // Create the File Open Dialog class.* NSOpenPanel* openDlg = [NSOpenPanel openPanel]; *// Enable the selection of files in the dialog.* [openDlg setCanChooseFiles:NO]; *// Enable the selection of directories in the dialog.* [openDlg setCanChooseDirectories:YES]; *// Display the dialog. If the OK button was pressed,** // process the files.* if ( [openDlg runModalForDirectory:nil file:nil] == NSOKButton ) { * //Takes the last object ( only one ) from the files array* NSString *files = [[openDlg filenames] lastObject]; NSFileManager *manager = [NSFileManager defaultManager]; *//Creates a File Manager * NSDirectoryEnumerator *dirEnumerator = [manager enumeratorAtPath:files]; *//Creates an enumerator* id object; *// Creates a generic object* while(object = [dirEnumerator nextObject]) { *//First We craft the whole path for a single object* NSString *fullPath = [files stringByAppendingPathComponent:object]; if(!fullPath) { NSLog(@Error when appending strings in appcontroller); } *//We check if the object is actually a dictionary or another file.* NSDictionary *fileAttributes = [manager fileAttributesAtPath:fullPath traverseLink:NO]; *//if file is regular... for now it's like this, I'll improve this later* if( [[fileAttributes objectForKey:NSFileType] isEqualToString:@ NSFileTypeRegular]) { Track *newTrack = [[Track alloc] init]; [albumsLibrary addTrackToLibrary:newTrack withPath:fullPath]; } } } totalFiles = [albumsLibrary count]; *//after this for loop is where the application crashes :)* for(j = 0; j totalFiles; j++) { [[albumsLibrary objectAtIndex:j] getTrackTags]; /*I get track tags*/ [[albumsLibrary objectAtIndex:j] printTagContents]; // I print tags in the console } } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Application crashing ( Maybe I'm over releasing object? )
On 20 Aug 2008, at 2:40 pm, Nicolas Goles wrote: Track *newTrack = [[Track alloc] init]; [albumsLibrary addTrackToLibrary:newTrack withPath:fullPath]; I didn't spot anything immediately obvious, but what's this doing? You alloc/init an object and DON'T release it as the rules say you should. What happens inside -addTrackToLibrary:? On the face of it this looks like a leak, rather than the error you reported, but it's still a bug. If -addTrackToLibrary: is releasing it it shouldn't be, it's not the object's owner. cheers, 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 [EMAIL PROTECTED]
Re: This document's file has been changed by another application?
Are you actually saving the contents of the document to a file inside the package? Try to get the document's fileURL and check if it is the same for the first and subsequent save operations, that might give a hint. The problem might also occur if you arbitrarily tweak the fileUrl. -Chaitanya On 19-Aug-08, at 9:36 PM, Chris Idou wrote: I've got a document based app where the document is actually a directory. Every time I save except the first time I get the above error whether or not things have changed, and even if the directory timestamp is unchanged. Under what circumstances does the above message occur and how do I avoid it? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/chaitanya%40expersis.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]