Zoom sometimes messes up resize increments
Hello. I have a window in my application for which I have set resize increments. When I click the zoom button in the window's title bar, sometimes it obeys the resize increments, i.e. the window fills the screen as much as possible without violating the resize increments. But sometimes the window resizes in such a way that it does violate the resize increments. I have not yet figured out what conditions exactly cause this. I suspect it has something to do with the initial size of the window, but I am not sure. I have created a minium working example. It is a standard Xcode- created Cocoa application, but I used a custom view for the content view of the main window. The custom view draws a grid and the window resize increments are the grid cell's dimensions. Here is the implementation of the custom view: === CODE BEGIN === #import CustomView.h #define CELL_WIDTH 100 #define CELL_HEIGHT 100 @implementation CustomView - (void)awakeFromNib { NSWindow *window = [self window]; // Set the size of the window content's height and width to a // multiple of the cell height and the cell width, respectively. NSRect frame = [window frame]; frame.size = NSMakeSize(5 * CELL_WIDTH, 5 * CELL_HEIGHT);; frame = [NSWindow frameRectForContentRect:frame styleMask:NSTitledWindowMask]; [window setFrame:frame display:TRUE]; // Set the window's resize increments to the cell dimensions. [window setResizeIncrements:NSMakeSize(CELL_WIDTH, CELL_HEIGHT)]; } - (void)drawRect:(NSRect)dirtyRect { NSRect bounds = [self bounds]; // Draw background color. [[NSColor whiteColor] set]; NSRectFill(bounds); // Draw a grid. [[NSColor gridColor] set]; CGFloat x = 0, y = 0; while (x bounds.size.width) NSFrameRect(NSMakeRect(x += CELL_WIDTH, 0, 1, bounds.size.height)); while (y bounds.size.height) NSFrameRect(NSMakeRect(0, y += CELL_HEIGHT, bounds.size.width, 1)); } @end === CODE END === When I played around with the values of CELL_WIDTH and CELL_HEIGHT, I noticed that the problem occurs for some values and for some it does not. For example, it does not occur when I use 100 and 100, but it does occur when I use 47 and 47. Am I doing something wrong or is this a bug? If I am doing something wrong, how can I do it right? If it is a bug, how can I work around it? Thanks in advance. Best regards, Jacob ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
MKPinAnnotationView callout behind other pins
Hey everyone, To start off, Im sorry if this is the wrong mailing for cocoa touch and iPhone MapKit related questions but I didn't know where else to go and you guys haven't let me down in the past. Onto my question. I have an iPhone app that has pins dispersed across an area. When I click on a pin, the callout pops up as normal, but it is SOMETIMES hidden by the other pins. I cannot find an answer anywhere on why this would be the case, let alone why it happens to some pins but not every pin. I don't know how much code you would need to see so Ill let you request to see what you need. Here is a screenshot: http://img43.imageshack.us/img43/78/screenshot20100119at938.jpg Thanks again. -Jake Schwartz___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Notification when displays are detected?
Hey all, After some searching through the API, which apparently I am not good at, I figured asking was easier. Does anyone know of a notification that gets posted when another screen is added/detected. I figured it would be in NSWorkspace but I didn't see anything. Thanks. -Jake Schwartz___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Notification when displays are detected?
I tried this one but it doesn't seem to be doing anything, so odds are I am adding the observer wrong. I am a little new at this, if that wasn't obvious haha. // Second notification, when the screens change [nc addObserver:self selector:@selector(handleBackgroundChange:) name:NSApplicationDidChangeScreenParametersNotification object:nil]; The handleBackgroundChange is just supposed to print a message with NSLog. -Jake Schwartz On Dec 29, 2009, at 1:26 PM, Paul Sanders wrote: NSApplicationDidChangeScreenParametersNotification Returns a stale value for [NSScreen visibleFrame] after the dock moves from one screen to another (on Snow Leopard at least). Solution: wait a second or so, then ask again. This notification is also sent when the screen arrangement or dock is reconfigured. I find this useful. Paul Sanders. - Original Message - From: Jacob Schwartz jakehschwa...@gmail.com To: cocoa-dev@lists.apple.com Sent: Tuesday, December 29, 2009 6:15 PM Subject: Notification when displays are detected? Hey all, After some searching through the API, which apparently I am not good at, I figured asking was easier. Does anyone know of a notification that gets posted when another screen is added/detected. I figured it would be in NSWorkspace but I didn't see anything. Thanks. -Jake Schwartz ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Notification when displays are detected?
No: NSNotificationCenter *nc = [[NSWorkspace sharedWorkspace] notificationCenter]; And Paul, it does exist because the other notification I have set up get recognized works and I cped the code. Thanks for all the help guys. -Jake On Dec 29, 2009, at 2:05 PM, Dave Keck wrote: Does nc == [NSNotificationCenter defaultCenter]? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Notification when displays are detected?
Dave, victory is yours. What is the difference between that center and my center? -Jake Schwartz On Dec 29, 2009, at 2:05 PM, Dave Keck wrote: Does nc == [NSNotificationCenter defaultCenter]? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Bad stardardUserDeafaults
Hello all, So I have a code segment that turns an NSString that is a file path on my computer into an NSURL, archives the NSURL into NSData, and then puts that into a NSMutableDictionary to be saved in the standardUserDefaults. I can archive and unarchive the NSData with no problem, but if I try to unarchive it after taking out of the dictionary, then it tells me (at least I think that is what gdb is telling me) that it is an NSButton. I have no clue where this could have come from and was hoping someone has had this problem before and fixed it. Thanks -Jake Schwartz ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Bad stardardUserDeafaults
Alright I'll have to do it after I get out of class. I didn't post it right away in case this was a common mistake, simple use of a wrong method. Thanks -Jake On Oct 1, 2009, at 3:38 PM, I. Savant idiotsavant2...@gmail.com wrote: On Oct 1, 2009, at 3:32 PM, Jacob Schwartz wrote: So I have a code segment that turns an NSString that is a file path on my computer into an NSURL, archives the NSURL into NSData, and then puts that into a NSMutableDictionary to be saved in the standardUserDefaults. I can archive and unarchive the NSData with no problem, but if I try to unarchive it after taking out of the dictionary, then it tells me (at least I think that is what gdb is telling me) that it is an NSButton. I have no clue where this could have come from and was hoping someone has had this problem before and fixed it. There's no way we can possibly answer your question without seeing your code. It *could* be a memory management issue or it could be a mistaken assignment, but there's no way to tell why your code is misbehaving when you haven't actually shown it. Just post the relevant parts (the storage part and the retrieval part). You don't have to share your whole project, but you *do* have to post the relevant code if you want help debugging it. -- 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 arch...@mail-archive.com
Re: Bad stardardUserDeafaults
I meant like if it was a common case. Nevermind though, here is the code: Archiving: NSMutableDictionary *defaultValues = [NSMutableDictionary dictionary]; NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@/ Users/jacobschwartz/Pictures/wallpapers]]; NSData *pathAsData = [NSKeyedArchiver archivedDataWithRootObject:url]; [defaultValues setObject:pathAsData forKey:JHSPathKey]; [[NSUserDefaults standardUserDefaults] registerDefaults:defaultValues]; Unarchiving: NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSData *pathAsData = [defaults objectForKey:JHSPathKey]; return [NSKeyedUnarchiver unarchiveObjectWithData:pathAsData]; And then I call: [textField setStringValue:[[self pathName] absoluteString]] (pathName is the unarchiving method) And gdb gives me this error: 2009-10-01 17:18:25.391 SyncBackground[452:a0f] -[NSButton absoluteString]: unrecognized selector sent to instance 0x10013a7b0 Thank you again. -Jake On Oct 1, 2009, at 3:51 PM, I. Savant wrote: On Oct 1, 2009, at 3:49 PM, Jacob Schwartz wrote: I didn't post it right away in case this was a common mistake That's the problem. If you think about it, how can we know what kind of mistake it was without seeing what you actually did? :-) -- 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 arch...@mail-archive.com
Re: Bad stardardUserDeafaults
I right, I didn't hit reply all. So I did found out how to do the breakpoint thing and I came across this: defaults = (NSUserDefaults *) 0x100425070 pathAsData = (NSData *) 0x0 I've done enough programming to that a memory address of 0x0 is null. This was in the first line of the pathName method, which I'll take to mean I am not doing a good job either saving the registering the dictionary as the standardUserDefaults or saving the object into the dictionary. But I haven't done enough Objective C programming to know what I did wrong/poorly. Thanks again for all the help -Jake On Oct 1, 2009, at 6:14 PM, Jens Alfke wrote: On Oct 1, 2009, at 2:19 PM, Jacob Schwartz wrote: NSMutableDictionary *defaultValues = [NSMutableDictionary dictionary]; NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@/ Users/jacobschwartz/Pictures/wallpapers]]; NSData *pathAsData = [NSKeyedArchiver archivedDataWithRootObject:url]; [defaultValues setObject:pathAsData forKey:JHSPathKey]; [[NSUserDefaults standardUserDefaults] registerDefaults:defaultValues]; FYI, you don't need to go to the trouble of archiving a URL to put it in defaults. Just store its absoluteString. That way the defaults are human-readable if someone ever needs to view/edit them by hand. NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSData *pathAsData = [defaults objectForKey:JHSPathKey]; return [NSKeyedUnarchiver unarchiveObjectWithData:pathAsData]; And then I call: [textField setStringValue:[[self pathName] absoluteString]] (pathName is the unarchiving method) This looks reasonable, although you're not showing us all the code. And gdb gives me this error: 2009-10-01 17:18:25.391 SyncBackground[452:a0f] -[NSButton absoluteString]: unrecognized selector sent to instance 0x10013a7b0 What this usually means is that the object you thought you had got deallocated, and its space was reused for some arbitrary other object. So the message ends up being sent to that new object instead of the one you wanted. What it sounds like is that your code that unarchives the URL is storing it somewhere without retaining it, and then later on your - pathName method gets called and returns that pointer, which by now has been dealloced and points to a different object. But without seeing how you implemented -pathName, I don't know for sure. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Disappearing NSStatusItem
Hello again, After making headway on my first cocoa app, I have run into an issue. I have created a NSStatusItem in my class called Application.m. When I run, the icon appears in my menubar but then disappears and becomes ineligable to click. I read something somewehere about thr garbage collection taking it away but I have it saved as an instance in my class so Im out of ideas. I also read about the AppDelegate class that is made for me when I make a new project but I don't know how to use that. Fail. Anyway thanks again everyone. -Jake ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Disappearing NSStatusItem
Yeah, I threw in a release statement after and it didn't do anything different. When I read your reply, I thought what Bill said, that garbage collection was different from release/retain statements. -Jake Schwartz On Sep 25, 2009, at 7:33 PM, Bill Bumgarner wrote: On Sep 25, 2009, at 4:30 PM, BravoBug Software wrote: Make sure you're properly -retain'ing it. Just because you have an ivar pointing to it doesn't mean it will stick around after GC/autorelease pool releases stuff. You'll need to explicitly -retain the NSStatusItem since NSStatusBar does not. Yes-- you need to explicitly retain anything you want to keep around when running under retain/release. Or you need a strong reference to it (or CFRetain it) if running under GC. However, the rest of the answer is very confusing. An objective-c program runs either garbage collected or using retain/release. GC/autorelease doesn't make any sense. b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Class for external monitor?
Hey everyone, I'm new to this mailing list and also new to objective-c/cocoa programming. I've gone through a book I picked up and I wanted to try to make a simple, run in the background application. To get to the point, I was looking through the documentation was looking for some class that would act as a reference to an external monitor or whatever is plugged into a laptops DVI port. My search came up empty, but I was hoping you guys could point me in the right direction. Thanks -Jake ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Class for external monitor?
Yeah, monitor without menu bar will work great, thank you and thanks to Graham, -Jake On Sep 21, 2009, at 11:55 AM, Scott Ribe wrote: Well I don't think there's a way to directly ask for the external monitor, but look at NSScreen first. Remember, on Mac it is easy to move the menu bar to whatever screen you want. So do you really want the external monitor, or do you want the monitor without the menu bar? The second one is easy, main vs non- main. The first might require you to dig into lower-level CGxxx or IOxxx APIs. -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Display either date part or time part in LOCAL format
I am probably overlooking something obvious (I hope) but what is the proper way to convert. either the Date or Time part of an NSDate to a localised string? I know I can do the following but its not exactly localised :( NSDate *now = [[NSDate alloc] init]; NSDateFormatter *localDate = [[NSDateFormatter alloc] init]; [localDate setDateFormat:@-MM-dd]; NSString *date = [localDate stringFromDate:now]; NSDateFormatter *localTime = [[NSDateFormatter alloc] init]; [localTime setDateFormat:@HH:mm:ss]; NSString *time = [localTime stringFromDate:now]; -- Jacob Rhoden http://jacobrhoden.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Detecting text under mouse
That is exactly what I am looking for, a Dictionary application is essentially assisting you with being able to read information on the screen. Unfortunately I cannot find any documentation at all on how to access a programs accessable information! The only information I can find are pages and posts saying there is no documentation! Does anyone know where I might find information on how to detect the accessability information under the mouse cursor? (I continue to search the apple documentation in the mean time) Thanks, Jacob FROM : Mr. George Warner DATE : Sat Jun 13 18:56:29 2009 VoiceOver uses the Accessibility APIs to do this. If you have the developer tools installed run the Accessibility Inspector app (in / Developer/Application/Utilities/Accessibility Tools/) and watch the info in the utility window change as you move the mouse over different parts of the screen. Note that Accessibility has to be turned on (via the Universal Access system preference panel) for this to work. -- Enjoy, George Warner, Schizophrenic Optimization Scientist Apple Developer Technical Support (DTS) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Detecting text under mouse
Hi, Is it possible to write an application that tracks the mouse over any application and reads the contents of the text that is under the mouse? I would like to develop an application that provides context sensitive translation as a learning tool. ie, See this windows application that is useful on Microsoft Windows for learning chinese: http://www.mdbg.net/chindict/chindict.php?page=chinese_dictionary_windows Best regards, Jacob -- Jacob Rhoden http://jacobrhoden.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Understanding how to display a context menu
Hey guys, I'm trying to understand the Apple docs for adding a context menu to an NSOutlineView: http://developer.apple.com/documentation/Cocoa/Conceptual/MenuList/Articles/DisplayContextMenu.html#//apple_ref/doc/uid/TP40004968 I am a bit stuck at how do you make it truly context sensitive, ie I'm trying to make a menu that has Add new person and Remove name, where name is the content of the row selected? I am guessing I need to talk back to the controller object which has the data? Perhaps somehow calling back to the data source object to ask it to build the menu (but I am not sure how to do that or if I should do that). This allows me to at least show the row number in the menu: @implementation NSContextOutlineView - (NSMenu *)defaultMenu { if([self selectedRow] 0) return nil; NSMenu *theMenu = [[[NSMenu alloc] initWithTitle:@Website context menu] autorelease]; [theMenu insertItemWithTitle:@Add new person action:@selector(addSite:) keyEquivalent:@ atIndex:0]; NSString* deleteItem = [NSString stringWithFormat: @Remove '%i', [self selectedRow]]; [theMenu insertItemWithTitle: deleteItem action:@selector(removeSite:) keyEquivalent:@ atIndex:1]; return theMenu; } - (NSMenu *)menuForEvent:(NSEvent *)theEvent { return [self defaultMenu]; } @end Any help much appreciated! Thanks, Jacob ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Date parsing problem (when running on iphone only)
Anyone experience this weird behaviour with date formatting? Given the following code, it produces a different log output when running in the simulator or on the iPhone!!! NSString* test = @Monday 26 January 2009 3:47:33 pm +; NSDateFormatter *df = [[NSDateFormatter alloc] init]; [df setDateFormat: @ dd h:mm:ss a Z]; NSLog(@DATE: %@ to %i, test, [df dateFromString: test]); This is the NSLog output on the iphone: 2009-03-04 22:08:49.645 Test[2875:20b] DATE: Monday 26 January 2009 3:47:33 pm + to 0 And this on the simulator: 2009-03-04 22:09:05.095 Test[68041:20b] DATE: Monday 26 January 2009 3:47:33 pm + to 5432224 Im completely stuck on this one! Are are there any other easy ways to parse dates? Any help appreciated. Thanks, Jacob Jacob Rhoden http://jacobrhoden.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Date parsing problem (when running on iphone only)
On 4/3/09 10:15 PM, Jacob Rhoden wrote: Anyone experience this weird behaviour with date parsing? Given the following code, it produces a different log output when running in the simulator or on the iPhone!!! NSString* test = @Monday 26 January 2009 3:47:33 pm +; NSDateFormatter *df = [[NSDateFormatter alloc] init]; [df setDateFormat: @ dd h:mm:ss a Z]; NSLog(@DATE: %@ to %i, test, [df dateFromString: test]); This is the NSLog output on the iphone: 2009-03-04 22:08:49.645 Test[2875:20b] DATE: Monday 26 January 2009 3:47:33 pm + to 0 And this on the simulator: 2009-03-04 22:09:05.095 Test[68041:20b] DATE: Monday 26 January 2009 3:47:33 pm + to 5432224 It seems that if you have your Regional settings to Chinese the date is not parsed. What is the proper way to parse an English formatted date? Thanks, Jacob -- Jacob Rhoden http://jacobrhoden.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Date parsing problem (when running on iphone only)
On 5/3/09 2:42 AM, Christopher Kane wrote: It seems that if you have your Regional settings to Chinese the date is not parsed. What is the proper way to parse an English formatted date? Yes, the date formatter you're creating defaults to using the user's locale, which can have settings which override even your attempt to set a specific format string. Do this after creating the formatter: [df setLocale:[NSLocale systemLocale]]; to set a generic locale object on the formatter. Thanks very much, that was the hint I needed to get it working. To share in case someone else has this problem for future reference: If you are trying to parse a date that will always be English, ie from a web page or web service, you need to tell the date parser to use the language of that web service. ie: NSString* test = @Monday 26 January 2009 3:47:33 pm +; NSDateFormatter *df = [[NSDateFormatter alloc] init]; [df setLocale: [[[NSLocale alloc] initWithLocaleIdentifier:@en_UK] autorelease]]; [df setDateFormat: @ dd h:mm:ss a Z]; If you don't do this, when you run your code on say a Chinese computer, it will fail (I am assuming its because January and Monday are not valid Chinese words). Imagine tracking down a bug that your software works on most computers except that one person in the office or that one iphone user who has changed their Regional Settings (It threw me because I am used to Java's date parsing being language agnostic) Best regards, Jacob -- Jacob Rhoden http://jacobrhoden.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Newbie: Learning path for my GTD app...
Hi, When I was first learning, the thing that really helped getting me started is the Aaron Hillegass book. This book should be enough to get you to the point where you can write basic applications. Once you have conquered the book, then the apple documentation at http://developer.apple.com/ is a really good reference point (its a bit more terse, and uses language that beginners dont always understand). (I sent this earlier but it seems to have gotten lost) Best regards, Jacob On 4/3/09 4:40 PM, Biagio wrote: Hello. My first post. I'm learning to program using Xcode 3.1.2 in OS X Leopard. My current plan of attack is working through these books: Learn C on the Mac C All in One Desktop Reference for Dummies Learn Objective-C On the Mac Cocoa Programming for Mac OS X 3rd edition by Aaron Hillegass -- Jacob Rhoden http://jacobrhoden.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [Q] What causes an NSArrayController to know that an entity was inserted via a different window?
On Feb 24, 2009, at 8:48 AM, Jon C. Munson II wrote: This is why Hillegass' book was extremely useful to me as I could see the concepts put into practice. Jon, like I.S. mentioned, it seems you need to get a better grasp on KVC/KVO concepts. Perhaps a re-read of Chapter 7 of Hillegass' Cocoa Programming For Mac OS X third edition book might help. Jacob ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How to handle clicks on NSOutlineView
Hi guys, I am trying to do an action when an item in an NSOutlineView is clicked. How do I work out which item was actually clicked on? Ive tried all sorts of things and nothing seems to work. (Google or Cocoa programmng for mac os x 3rd edition are not that helpful on this!) -(void)awakeFromNib { [outline setAction:@selector(loadMemberList:)]; } -(IBAction)loadMemberList:(id)sender { if(ldap.connected) { NSLog(@Load members); NSLog(@ site %@ ,[[outline selectedCell] name]); } } Thanks, Jacob -- Jacob Rhoden http://jacobrhoden.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to handle clicks on NSOutlineView
On 14/2/09 3:39 PM, Graham Cox wrote: On 14 Feb 2009, at 12:22 pm, Jacob Rhoden wrote: I am trying to do an action when an item in an NSOutlineView is clicked. How do I work out which item was actually clicked on? Ive tried all sorts of things and nothing seems to work. (Google or Cocoa programmng for mac os x 3rd edition are not that helpful on this!) For an outline view you can also use -itemAtRow: to directly get the object to which it refers. Thansks! That was the method I was looking for, I didnt think to look for methods there! -- Jacob Rhoden http://jacobrhoden.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Read lines from very large text file
On 3/2/09 4:55 PM, Michael Ash wrote: Everything I've seen in this thread so far skimps on one important detail: If you're just looking at the raw data, how do you know how to interpret it? It hasn't been addressed because it's not really relevant to the question at hand. Yes, you definitely need to either know or be able to discover the text encoding of the text files you're dealing with. But aside from both being about text files, that question is unrelated to the question of how to process a large text file line-by-line. Exactly, I was looking for direction on the technically best way to read a very large file line by line. In future I will be sure to include a concrete example. (: It is not uncommon that I might have to deal with server logs that go into the gigabytes. Most logs (apache, squid, etc...) are all ascii encoded. The line ending is irrelevant, see a \n or a \r and we know we have reached the end of a entry in the log. Thanks, Jacob -- Jacob Rhoden http://jacobrhoden.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Read lines from very large text file
Yea, I saw this and some posts on the apple forum saying NSInputStream is not the right way, hence the question, what is the right way to analyze a very large file line by line. cf the apple thread http://discussions.apple.com/thread.jspa?threadID=1187120tstart=400 On 3/2/09 12:57 AM, Alexander Spohr wrote: NSInputStream? Am 02.02.2009 um 14:42 schrieb Jacob Rhoden: I am wondering what the best way to read a text file, line by line, when the file size is much larger than available memory. I know there are helper functions like stringWithContentsOfFile:encoding:error:, but this implies having to load the entire file in memory. Google has not been of much extra help here. Thanks! Jacob ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Read lines from very large text file
Hi Guys, I am wondering what the best way to read a text file, line by line, when the file size is much larger than available memory. I know there are helper functions like stringWithContentsOfFile:encoding:error:, but this implies having to load the entire file in memory. Google has not been of much extra help here. Thanks! Jacob Jacob Rhoden http://jacobrhoden.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Mac Pro memory sizes
Depending on what sort of data you has, you could try allocating all of your memory on startup, organised into related zones. That way you are not constantly allocating/deallocating anything. Just overwriting values. This can provide an unbelievable speed inprovement, and low memory overheads/paging and so on. On 12/1/09 8:44 AM, julius wrote: Hi, Not sure if I'm addressing the right list for this topic. I'm just trying to get a notion of my memory requirements for a program I am designing to run on my Mac Pro. I will have large volumes of data passing through the program and I'm worrying about minimising page collisions I've had a quick look on the net but can't find answers to the types of questions i'm asking below. If anyone knows a good link I'd appreciate it. I guess I ought to run some trials and no doubt will do once I have something running but someone ought to know the answers so My questions are: About This Mac says that I have 2GB of internal memory. Is this 2GB of 64-bit words or 2GB of 8-bit bytes? I appreciate that GB is Giga Byte but .. Similarly with respect to the L2 Cache, I have 12 MB per processor, is that 12 MB by 8 bits or 64 bits? In thinking about memory usage, where previously I would think of my program in terms of 8 or 16 or 32 bit words should I now be thinking in terms of 64 bit words? That is, should I think of my available internal memory space as effectively being 500MB words? Similarly, say that I had 100MB of 2 x 8-bit byte integers to save to disk, should I now think that this will be saved as 100MB by 64 bit (i.e. 8 x 8-bit byte) integers? If it is 100MB by 64 bit integers then should I think of compressing the data so as to reduce bandwidth requirements? Thanks Julius http://juliuspaintings.co.uk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NKE Kernel extension
Hi, Anyone here ever done any Network kernel extensions? I am trying to start by doing something simple as monitoring network traffic, but the apple documentation isn't getting me very far? Anyone know any useful websites or tutorials in this area? Best regards, Jacob ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Stumped on memory problem :(
I have read the memory management documentation over and over but still cannot work out the problem with this code, can anyone see it? I have spent hours on this! +(NSMutableArray*)getStrings { NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; [dict setValue: @ forKey: [NSString stringWithString:@one]]; [dict setValue: @ forKey: [NSString stringWithString:@two]]; NSMutableArray *array = [[NSMutableArray array] init]; NSEnumerator* keyEnum = [dict keyEnumerator]; NSString* key; while ((key = [keyEnum nextObject])) { [array addObject: key]; } [dict release]; return [array autorelease]; } // Here is where I call the above function NSMutableArray* a =[StringHelper getStrings]; [a retain]; for(int i=0;ia.count;i++) { NSLog(@ %@,(NSString*)[a objectAtIndex: i]); } [a release]; AFTER the code is complete I see the following message, the address location is always the pointer to the array created in the getStrings method. 2009-01-02 12:07:29.277 Test[5184:813] *** -[CFArray release]: message sent to deallocated instance 0x132950 Any help muchly appreciated. I have tried with and without the [a retain] and [a release]. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Making an object release itself?
Im still learning cocoa, so I have a question about if this is a good idea or a crazy noob mistake. Given the following code can I alter it so that postreader auto releases itself? -(IBAction) fetchThreads:(id) sender { [progress startAnimation:nil]; PostReader* reader = [[PostReader alloc] init]; [reader loadLatestPosts: self]; } // Callback message -(void) postsRead { [progress stopAnimation:nil]; } Does it make sense that I could clean up things to work more like this: -(IBAction) fetchThreads:(id) sender { [progress startAnimation:nil]; [PostReader loadLatestPosts: self]; } -(void) postsRead { [progress stopAnimation:nil]; } I'm thinking PostReader class could have a static function that initialises a new PostReader object, tells it to start the work, and then do a [self release] after it has called the callback function 'postsRead'; Thanks! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Odd EXEC_BAD_ACCESS after executing URLRequest
On 31/12/08 3:10 AM, marc hoffman wrote: i'm hoping someone has an idea here - i'm seeing odd crashes after doing URL requests. the first request completes fine (up to it triggering connectionDidFinishLoading:), but shortly after or while doing a subsequent request... Are you sure you are not accidentally triggering two 'send message' calls concurrently. One of the most common causes of this problem is that your second request is over-writing the variables of an already in progress request. Check that done is not set to yes when you call your 'send message' function. Regards, Jacob ___ http://jacobrhoden.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Sorting an NSMutableArray
How do you sort an NSMutableArray, when the difference between the two objects is determined by information not contained completely within the objects themselves. ie in Java you can implement a Comparator that takes two objects to compare then. Is this similar in Cocoa? ie in this case I need to apply a mathematical algorithm using information from each object to determine which one is greater than the other. Thanks! Jacob http://jacobrhoden.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
CLLocationDistance contents?
Hi Guys, I am doing the following to find a distance between two locations: CLLocation* venueLocation = [[CLLocation alloc] initWithLatitude: venue.latitude longitude:venue.longditude]; CLLocationDistance distance = [venueLocation getDistanceFrom:currentLocation]; Is distance in metres/miles/km? How do I display it on screen in a platform independent way? I cant find any examples in the developer centre thingy. Thanks -jacob --- http://jacobrhoden.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CLLocationDistance contents?
CLLocation* venueLocation = [[CLLocation alloc] initWithLatitude: venue.latitude longitude:venue.longditude]; CLLocationDistance distance = [venueLocation getDistanceFrom:currentLocation]; Is distance in metres/miles/km? How do I display it on screen in a platform independent way? On 19/12/08 11:42 AM, David Duncan wrote: From the documentation of -getDistanceFrom: Returns the distance (in meters) from the receiver’s coordinate to the coordinate of the specified location. Thanks Duncan! Why do people always seem to be able to find stuff in the documentation. When I Option + Mouse double click on CLLocationDistance Xcode only shows me this! CLLocationDistance A distance measurement from an existing location. typedef double CLLocationDistance; Availability Available in iPhone OS 2.0 and later. Declared In CLLocation.h ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Beginner memory management question
I am not sure how one would go about working this, Im writing my first test os/x applications and I am thinking this is probably not right. Am I doing the retain in the correct place? I tried reading the documentation on NSTextField but it didnt give me a clue about if I needed to retain. (Infact stringValue is not even mentioned in the NSTextField documentation). @interface StockListController : NSObject { IBOutlet NSTextField* stockName; NSString *newName; } -(IBAction) addStockItem:(id)sender; @end @implementation StockListController -(IBAction) addStockItem:(id)sender { if(newName == nil) [newName release]; newName = [stockName stringValue]; [newName retain]; } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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]
Correct location to store application data.
I have an application which contains a dictionary file of sorts. Users can add/alter/and remove entries from a dictionary. I assume I will have the default dictionary stored as part of the application bundle somehow, and I should be saving a copy of some sort in a second hidden location, ie it doesnt make sense to store it in the Documents folder. Best regards, Jacob ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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]
Detecting in/activity
Hi all, I'd like to have an app/daemon/something detect when the computer becomes active after a period of inactivity, much like iChat does when it says Welcome back! Would you like to change your status from Does anyone have any insight as to the best way to do that? 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: Data Types for Extracting samples from Audio Buffer
On Oct 5, 2008, at 09:47, Joseph Ayers wrote: I'm trying to extract the audio samples from an audio buffer returned from the QuickTime Audio extraction API into a NSMutableArray of NSNumbers. snip The code I am using is: AudioBufferList* abl; NSMutableArray * ipbuf; NSMutableArray * idbuf; NSNumber* ipsamp; NSNumber* idsamp; unsigned short *ippointer = (unsigned short *)abl- mBuffers[0].mData; unsigned short *idpointer = (unsigned short *)abl- mBuffers[1].mData; for (isamp = 1; abl-mBuffers[0].mDataByteSize;isamp++){ [ipsamp initWithUnsignedShort:(unsigned short)ippointer[isamp]]; [ipbuf insertObject:ipsamp atIndex:isamp]; [idsamp initWithUnsignedShort:(unsigned short)idpointer[isamp]]; [idbuf insertObject:idsamp atIndex:isamp]; } The program crashes on the line [ipsamp initWithUnsignedShort:(unsigned short)ippointer[isamp]]; with Program received signal: “EXC_BAD_ACCESS”. Try this on for size: // Edited in Mail -- not guaranteed to even compile // Completely untested AudioBufferList* abl = /* fetch valid AudioBufferList */; NSMutableArray * ipbuf = [NSMutableArray array]; NSMutableArray * idbuf = [NSMutableArray array]; NSNumber* ipsamp = nil; // not strictly necessary NSNumber* idsamp = nil; unsigned short *ippointer = (unsigned short *)abl-mBuffers[0].mData; unsigned short *idpointer = (unsigned short *)abl-mBuffers[1].mData; // Skipping first sample // where is isamp declared? for (isamp = 1; isamp abl-mBuffers[0].mDataByteSize; isamp++){ ipsamp = [NSNumber numberWithUnsignedShort:(unsigned short)ippointer[isamp]]; [ipbuf addObject:ipsamp]; idsamp = [NSNumber numberWithUnsignedShort:(unsigned short)idpointer[isamp]]; [idbuf addObject:idsamp]; } -Jacob___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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]
Synchronous modal sheet
I want to display a modal sheet, but my code isn't currently at the point where I can split it up. Is there a way to run a modal sheet synchronously, so the rest of the code after it starts isn't called until it ends? Or do I have no choice but to restructure 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: Synchronous modal sheet
Yeah, I've worked with sheets before in different contexts. The problem with this one is that I want to display the sheet during the first iteration of a loop (in which I do a bit of work with other loops), and splitting it up will take some work. But unless there are any good alternatives to a sheet, I suppose I'll go for it. On Aug 15, 2008, at 3:52 AM, Graham Cox [EMAIL PROTECTED] wrote: On 15 Aug 2008, at 3:16 pm, Jacob Bandes-Storch wrote: I want to display a modal sheet, but my code isn't currently at the point where I can split it up. Is there a way to run a modal sheet synchronously, so the rest of the code after it starts isn't called until it ends? Or do I have no choice but to restructure this? If you have to have a sheet, you have no choice. But it's not that hard. Take the code that runs after the call, factor it into another method, then call that method from the - sheetDidEnd:returnCode:contextInfo: method. 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]
Custom URL Handling
I want to implement a custom URL scheme (such that myscheme:whatever will open my app and somehow pass the URL as a parameter). I've been looking around for information on how to do that, and I'm getting mixed messages. The Info.plist documentation is very clear, and I've got the keys all set up the right way such that my app opens when a URL of my custom scheme is opened. However, I'm not sure how to find out what URL was opened. I see some implementations use -[NSAppleEventManager setEventHandler:andSelector:forEventClass:andEventID:]; with kInternetEventClass and kAEGetURL, and they implement a method (passed into the selector): - (void)handleURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent. In other places, I see LSSetDefaultHandlerForURLScheme, and other LS* stuff. Another thing I've seen is adding a script suite and using performDefaultImplementation and [self directParameter] to get the URL. So, I need to know what the right way to do this is. I don't see any specific information about this in Apple's documentation. 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: Custom URL Handling
It doesn't seem to make sense to use the script suite stuff to receive the URL event.. shouldn't it be used for scripting only? Or am I mistaken? On Aug 9, 2008, at 3:03 PM, Uli Kusterer wrote: I see some implementations use -[NSAppleEventManager setEventHandler:andSelector:forEventClass:andEventID:]; with kInternetEventClass and kAEGetURL, and they implement a method (passed into the selector): - (void)handleURLEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent. (...) Another thing I've seen is adding a script suite and using performDefaultImplementation and [self directParameter] to get the URL. When a URL is opened, an Apple Event of kInternetEventClass/ kAEGetURL is sent, containing the URL. If you want to handle the URL, you'll need to catch this somehow. Cocoa AppleScript support is fairly new (I think 10.2 or 10.3 or thereabouts). So, depending on what system version your app has as its minimal requirement, you'll either use NSAppleEventManager (which is the older class, AFAIK) or the script suite. Instead of performDefaultImplementation, I think you could also just create an NSScriptCommand or whatever the class was called. Whatever feels cleaner to you. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSTextView + other NSView in NSScrollView?
Alright, I'm able to get a view that can resize to a NSTextView subview's size, and it works as the document view of a scroll view, but I'm still not sure how to make it work with another view above it. On Mon, Jul 28, 2008 at 8:53 AM, Andy Lee [EMAIL PROTECTED] wrote: I don't know offhand. A quick search on CocoaBuilder for NSTextView flipped turns up this suggestion to flip the superview: http://www.cocoabuilder.com/archive/message/cocoa/2004/6/20/110164 But I haven't read it closely. --Andy On Jul 28, 2008, at 11:09 AM, Jacob Bandes-Storch wrote: On Jul 28, 2008, at 7:48 AM, Andy Lee [EMAIL PROTECTED] wrote: On Jul 27, 2008, at 11:31 PM, Jacob Bandes-Storch wrote: I'm trying to create a Mail-style scroll view, with a view for information (like the view for message headers) above a text view for the content. I created two NSViews in Interface Builder, changed the class of the bottom one to NSTextView, Just one more thought: I think some people have mentioned unexpected resizing behavior because they didn't take into account the fact that NSTextView uses a flipped coordinate system. Yes, I was wondering about that. It seems like that's the issue I run into when trying to use an NSTextView that's not the documentView of the NSScrollView. What can I do to work around that? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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]
CSV parsing (large files)
I've got several large-size CSV files (a total of about 1.25 million lines, and an average of maybe 10 or so columns) that I want to parse into a 2D array. I found some parsing code that uses NSScanner, and it works fine with small files, but it's very resource-intensive and slow with large files. Should I try and optimize it more, or try using C instead of Objective-C for parsing, or what? The ultimate goal here is to convert the CSV files into a SQLite database. Should I even be doing it this way? Maybe just one row into the database at a time? I'd like to hear people's opinions. 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: NSTextView + other NSView in NSScrollView?
On Jul 27, 2008, at 10:49 PM, Andy Lee wrote: On Jul 27, 2008, at 11:31 PM, Jacob Bandes-Storch wrote: I'm trying to create a Mail-style scroll view, with a view for information (like the view for message headers) above a text view for the content. I created two NSViews in Interface Builder, changed the class of the bottom one to NSTextView, Is there some reason you didn't drag an NSTextView into the window in the first place? Because the Text View that IB provides is embedded in a scroll view already and I can't add another view to it. selected both, and clicked Layout Embed Objects In Scroll View. Are you sure you didn't want a Split View rather than a Scroll View? If you were trying to create a Mail-like layout, I would have expected your two views to be an NSTableView and an NSTextView, both embedded in a Split View. No... what I want is like the bottom half of Mail's split view, with the view for the headers and the text view with the message content. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: NSTextView + other NSView in NSScrollView?
On Jul 28, 2008, at 7:48 AM, Andy Lee [EMAIL PROTECTED] wrote: On Jul 27, 2008, at 11:31 PM, Jacob Bandes-Storch wrote: I'm trying to create a Mail-style scroll view, with a view for information (like the view for message headers) above a text view for the content. I created two NSViews in Interface Builder, changed the class of the bottom one to NSTextView, Just one more thought: I think some people have mentioned unexpected resizing behavior because they didn't take into account the fact that NSTextView uses a flipped coordinate system. Yes, I was wondering about that. It seems like that's the issue I run into when trying to use an NSTextView that's not the documentView of the NSScrollView. What can I do to work around that? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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]
IB view transitions, CA, NSWindow animation
For a bit of background, I've got a window, and I'll be swapping its content view's subview between some other views. One (and more in the future) of the other views has a subview with wants layer set so it can use some CALayer stuff for fading and such. Now, when I switch between views for the window, I want the window to resize, and a nice animated transition (like a cube). For resizing, the logical method is -[NSWindow setFrame:display:animate:]. This all works fine... until a descendant subview has a layer. Then I get a pause, and the window resizes without animating. If I remove the layer from the subview, the animation works. (The subview is a descendant of the view which I am *removing* from the window *before* changing the size. Why does it make a difference anyway?) For the animated transition, it appears that IB has a setting for some predefined transitions. I set the window's subviews transition to Rotating Cube... and yet, I don't get a rotating cube effect when removing a subview and adding another. If I use the content view's animator ([[window contentView] animator]) to add the subview, nothing seems to change... If I do the same, only addSubview:[newView animator] as well, it seems to try, but it doesn't work all that well. Can anyone give me some advice here? What am I doing that's ruining the NSWindow resize animation? How can I get the view transitions working? 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: IB view transitions, CA, NSWindow animation
By one content view, do you mean a view inside the window's content view? It appears to do the same thing. The resizing animation works when it has a layer, but then again the same thing happens with the content view having a layer. On Jul 27, 2008, at 11:58 AM, Milen Dzhumerov wrote: On 27 Jul 2008, at 07:36, Jacob Bandes-Storch wrote: [snip] For resizing, the logical method is -[NSWindow setFrame:display:animate:]. This all works fine... until a descendant subview has a layer. Then I get a pause, and the window resizes without animating. If I remove the layer from the subview, the animation works. (The subview is a descendant of the view which I am *removing* from the window *before* changing the size. Why does it make a difference anyway?) [snip Can anyone give me some advice here? What am I doing that's ruining the NSWindow resize animation? How can I get the view transitions working? Thanks in advance. This is a known bug (rdar://problem/5827811). Workaround by using one content view and replacing the subview of the content view. M ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSWindow resize problems
I managed to get the table column to resize properly by following your instructions. but as for the window itself: Just to make sure, when you say leftmost strut in autosizing controls you mean the red spacers? They are set for all objects in my window, but still the problem persists. Another thing when I maximize and then resize the window a tiny bit the objects all fall into their correct place..? Jacob Kolding [EMAIL PROTECTED] On Jul 27, 2008, at 10:11 AM, Nathan Kinsinger wrote: On Jul 26, 2008, at 9:02 AM, Jacob Ole Juul Kolding wrote: Hello List I've implemented at main window in IB and set resize attributes for all my objects which works as desired, but I have two problems. First, when i maximize the app the objects in the window are resize but not placed properly. meaning that a large empty space resides in the left side of the window? Make sure that the leftmost strut in the Autosizing control is set, otherwise the distance from the left edge of the window to your controls will vary depending on the size of the window. Second, I have a NSTableView with a single column in my window. The column doesn't automatically resize to fit the width of the table? Make sure to: 1) resize the column in IB to match the size of the table as it exists in the nib 2) set all the strut and springs for the NSTableView (this is for how it resizes inside the NSScrollView, not the window) (these next ones are the defaults, but you may have changed them so double check) 3) set the Column Sizing popup for the NSTableView to First Column Only or Last Column Only 4) set the Resizing checkbox for the NSTableView 5) set Resizes With Table for the NSTableCloumn Also, if it makes sense for your view, you may want to set the Maximum Constraint of the NSTableColumn to some large number (30 monitors are 2560 pixels wide today and people can have two or more monitors next to each other, the default is 1000 pixels) Can anyone tell me how to solve these issues? Jacob Kolding [EMAIL PROTECTED] --Nathan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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]
Containers in Cocoa, adding objects to NSView programmatically?
Hello List I'm been reading the documentation quit a bit but haven't found the answer. My problem is that I don't really understand how containers work in Cocoa, I know NSView, but how do I add an object to it programmatically, say a NSImage? Any pointer greatly appreciated! Jacob Kolding [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]
NSTextView + other NSView in NSScrollView?
I'm trying to create a Mail-style scroll view, with a view for information (like the view for message headers) above a text view for the content. I created two NSViews in Interface Builder, changed the class of the bottom one to NSTextView, selected both, and clicked Layout Embed Objects In Scroll View. This all works (it puts the views inside a scroll view), but the NSTextView doesn't play well with the scroll view when it increases in size, and when the scroll view changes size. When the text view increases in size, instead of just getting longer by a line, it gets longer and moves down, and the scroll view doesn't enable the scrollbar. If I shrink the scroll view by means of resizing the window (and I do have the autosizing set properly), the text view moves up erratically, and doesn't move back down when I increase the window size again. Everything works just fine when I create an NSTextView and embed it in a scroll view without another view alongside... because the NSTextView itself becomes the scroll view's document view. So... what's the right way to go about doing this? Should I even try to be putting 2 views in a scroll view for the effect I'm aiming for? 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: (Newb question?) Launching app on dock icon file drop?
I figured it out by adding keyCFBundleDocumentTypes/key array dict keyCFBundleTypeExtensions/key array string/string /array keyCFBundleTypeName/key stringDocumentType/string keyCFBundleTypeOSTypes/key array string/string /array keyCFBundleTypeRole/key stringEditor/string /dict /array in Info.plist Thanks! Jacob Kolding [EMAIL PROTECTED] On Jul 26, 2008, at 3:42 AM, Ken Thomases wrote: On Jul 25, 2008, at 6:51 PM, Jacob Ole Juul Kolding wrote: I been searching for quite a while and reading the source code for DockScript by still no luck. Can anyone tell me how to make an Cocoa app launch when a file is drag 'n droped on it's icon? Well, it does so by default -- if the drop is permitted. The Dock decides if the drop is permitted based on the document types that the application claims to handle in its Info.plist file. http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/ConfigApplications.html http://developer.apple.com/documentation/Cocoa/Conceptual/Documents/Concepts/DocTypePList.html By the way, you can force the Dock to accept the drop, regardless of the claimed document types, by holding down Command and Option. 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]
NSWindow resize problems
Hello List I've implemented at main window in IB and set resize attributes for all my objects which works as desired, but I have two problems. First, when i maximize the app the objects in the window are resize but not placed properly. meaning that a large empty space resides in the left side of the window? Second, I have a NSTableView with a single column in my window. The column doesn't automatically resize to fit the width of the table? Can anyone tell me how to solve these issues? Jacob Kolding [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: NSString sizeWithAttributes inaccuracy
It's more than one pixel. First time i noticed it was with a string of about 140 chars which gut truncated about 10 chars. Jacob Kolding [EMAIL PROTECTED] On Jul 25, 2008, at 11:19 AM, Manfred Schwind wrote: he problem is that on very large strings sizeWithAttributes comes up short [no pun intended] How much too short? Is it less than 1 pixel? float tiw = [self stringPixelWidth:[records objectAtIndex:i]]; if(tiw maxWidth){ maxWidth = tiw; } [...] [[[myTableView tableColumns] objectAtIndex:0] setWidth:maxWidth]; I think table columns are expected to have integer widths, so you have to round up to the next integer, e.g. like that: [[[myTableView tableColumns] objectAtIndex:0] setWidth:ceilf(maxWidth)]; Mani -- http://mani.de - friendly software iVolume - listen to music freehand LittleSecrets - the encrypted notepad ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: NSString sizeWithAttributes inaccuracy
IIRC from my debugging sessions sizeWithAttributes already does that? Jacob Kolding [EMAIL PROTECTED] On Jul 25, 2008, at 1:47 AM, Aki Inoue wrote: Try using -boundingRectWithSize:options:attributes instead with NSStringDrawingUsesDeviceMetics. Aki On 2008/07/24, at 14:23, Jacob Ole Juul Kolding wrote: Hello List I'm working on an app where I have a NSTableView with one column containing strings. I want this column to automatically resize itself within the ScrollView to fit the width of the widest string. In order to do this I came up with the following code: -(void)calculateCellTextAttribs{ NSFont* font = myTableView tableColumns] objectAtIndex:0] dataCell] font]; myCellAttributes = [[NSMutableDictionary alloc] init]; [myCellAttributes setObject:font forKey:NSFontAttributeName]; } -(float)stringPixelWidth:(NSString*) theString{ NSSize extent = [theString sizeWithAttributes:myCellAttributes]; return 1.1*extent.width; } -(void)updateTable{ [myTableView reloadData]; if([records count]){ //records is a NSArray of NSString float maxWidth = 0; int i = 0; for(i = 0; i [records count]; i++){ float tiw = [self stringPixelWidth:[records objectAtIndex:i]]; if(tiw maxWidth){ maxWidth = tiw; } } [[[myTableView tableColumns] objectAtIndex:0] setWidth:maxWidth]; } } The problem is that on very large strings sizeWithAttributes comes up short [no pun intended] Hence the 1.1 return multiplier in stringPixelWidth. Does anyone know why this happens or if there is a simpler way to achieve my goal? Any help appreciated! Jacob Kolding [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/aki%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]
(Newb question?) Launching app on dock icon file drop?
I been searching for quite a while and reading the source code for DockScript by still no luck. Can anyone tell me how to make an Cocoa app launch when a file is drag 'n droped on it's icon? Any pointer greatly appreciated! Jacob Kolding [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]
NSString sizeWithAttributes inaccuracy
Hello List I'm working on an app where I have a NSTableView with one column containing strings. I want this column to automatically resize itself within the ScrollView to fit the width of the widest string. In order to do this I came up with the following code: -(void)calculateCellTextAttribs{ NSFont* font = myTableView tableColumns] objectAtIndex:0] dataCell] font]; myCellAttributes = [[NSMutableDictionary alloc] init]; [myCellAttributes setObject:font forKey:NSFontAttributeName]; } -(float)stringPixelWidth:(NSString*) theString{ NSSize extent = [theString sizeWithAttributes:myCellAttributes]; return 1.1*extent.width; } -(void)updateTable{ [myTableView reloadData]; if([records count]){ //records is a NSArray of NSString float maxWidth = 0; int i = 0; for(i = 0; i [records count]; i++){ float tiw = [self stringPixelWidth:[records objectAtIndex:i]]; if(tiw maxWidth){ maxWidth = tiw; } } [[[myTableView tableColumns] objectAtIndex:0] setWidth:maxWidth]; } } The problem is that on very large strings sizeWithAttributes comes up short [no pun intended] Hence the 1.1 return multiplier in stringPixelWidth. Does anyone know why this happens or if there is a simpler way to achieve my goal? Any help appreciated! Jacob Kolding [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]
NSStatusItem custom view with menu
I'm making an NSStatusItem with a custom view. In drawRect:, it draws things based on the value of the highlighted instance variable. When mouseDown: is called, it pops up a menu using the status item's popUpStatusItemMenu: method. Using the mouseUp: event does not work, because it is not called after the menu goes away. This is the way I've found that makes it work: - (void)mouseDown:(NSEvent *)theEvent { highlighted = YES; [self setNeedsDisplay:YES]; [statusItem popUpStatusItemMenu:menu]; highlighted = NO; [self setNeedsDisplay:YES]; [super mouseDown:theEvent]; } Is this a good method, or is there something better that involves mouseUp:? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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]
Leopard-specific functionality in non–Leopard -only project
I'm working on a project (with another developer) that will target OSes older than 10.5, and I'd like to use the Leopard-only NSWindow method -setCollectionBehavior:. As far as I know, the best way to do this is to check for the method using -respondsToSelector:. I need to use the enum type NSWindowCollectionBehavior. When I try this, I get an error saying error: 'NSWindowCollectionBehaviorCanJoinAllSpaces' undeclared (first use in this function) and a warning warning: 'NSWindow' may not respond to '-setCollectionBehavior:'. This is because I'm using the 10.4 SDK... I've read in some places to set the Cross-develop using target SDK setting of the project to 10.5, but that setting is not available in the General tab of the project info. Does anyone know how to do this properly without angering the compiler? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Leopard-specific functionality in non–L eopard-only project
Alright, thanks, but will that work if someone tries to use the project for development who's not on 10.5? On Sat, Jun 21, 2008 at 1:01 PM, Mark Munz [EMAIL PROTECTED] wrote: The trick is to set the SDK to 10.5 and then in the target build settings, set: Mac OS X Deployment Target to Mac OS X 10.4. (under Deployment) You'll want to set it for all your configurations: (Debug, Release, etc) On Sat, Jun 21, 2008 at 12:51 PM, Jacob Bandes-Storch [EMAIL PROTECTED] wrote: I'm working on a project (with another developer) that will target OSes older than 10.5, and I'd like to use the Leopard-only NSWindow method -setCollectionBehavior:. As far as I know, the best way to do this is to check for the method using -respondsToSelector:. I need to use the enum type NSWindowCollectionBehavior. When I try this, I get an error saying error: 'NSWindowCollectionBehaviorCanJoinAllSpaces' undeclared (first use in this function) and a warning warning: 'NSWindow' may not respond to '-setCollectionBehavior:'. This is because I'm using the 10.4 SDK... I've read in some places to set the Cross-develop using target SDK setting of the project to 10.5, but that setting is not available in the General tab of the project info. Does anyone know how to do this properly without angering the compiler? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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]
Tab-based (document-based?) application
I'm creating an application that will have an arbitrary number of basically identical windows (document-like) which each have tabs (or something of the sort) in them that represent the actual documents, per se. Would it be best to start out with a Document-Based Application or just a regular Cocoa application? Any tips on doing 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]
HUD-style panel controls?
I'm adding a HUD panel to my application. Looking around, I don't see a way to get the proper style of controls easily. The Human Interface Guidelines say that HUD controls should be white with gray accents and use white or gray text. And yet I don't see a way to get these controls (gray sliders, semitransparent buttons, etc.) in Interface Builder. Am I missing something? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: HUD-style panel controls?
Done. #5860547. On Sat, Apr 12, 2008 at 7:21 PM, Michael Watson [EMAIL PROTECTED] wrote: You aren't missing anything. Apple gave us an official HUD panel and UI guidelines surrounding it, and failed to provide any HUD-style controls to go with it. If the idea is to give us something standard, so everyone's not rolling slightly different HUD panels, we should have at least /some/ standard HUD controls. Please, please file an enhancement request. -- m-s On 12 Apr, 2008, at 22:01, Jacob Bandes-Storch wrote: I'm adding a HUD panel to my application. Looking around, I don't see a way to get the proper style of controls easily. The Human Interface Guidelines say that HUD controls should be white with gray accents and use white or gray text. And yet I don't see a way to get these controls (gray sliders, semitransparent buttons, etc.) in Interface Builder. Am I missing something? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/mikey-san%40bungie.org 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 inspect pending performSelectorOnMainThread ?
Hi all, In a separate thread I call: [self performSelectorOnMainThread: @selector(broadcastMessage:) withObject: nil waitUntilDone: NO]; Now, is there a way for the main thread to inspect the queue of pending messages, their targets and arguments? (I would like my unit test to verify that -broadcastMessage: has actually been sent to the main thread.) Thanks, jak ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: NSViewController's representedObject and NSArrayController's selection don't mix?
In diagnosing this problem, I tried to use the NSKeyValueObservingOptionPrior when observing NSArrayController's selection, but I never got a observeValueForKeyPath:ofObject:change:context: where the change dictionary contained an NSKeyValueChangeNotificationIsPriorKey entry. This leads me to believe that the issue is being caused by the selection proxy object's target is getting changed before I (or KVO) get any notification of the change. I've worked around this issue by setting the NSViewController's representedObject to nil in the table delegate method tableView:shouldSelectRow: and set it back to -[NSArrayController selection] in tableViewSelectionDidChange:. This works, but flashes to blank before changing to the new value. I tried NSDisableScreenUpdates/ NSEnableScreenUpdates, which reduced the flash length, but didn't remove it. Is there a better way to do what I'm trying to do? Thank you, Jacob Lukas On Apr 6, 2008, at 22:52, Jacob Lukas wrote: I have a table of Core Data objects and a set of inspector views. Depending on the Class(es) of the selection in the table view, the set of inspector views changes. I managed the inspector views with NSViewControllers. The fields in the inspector view are bound to the view controller's representedObject -- ex. representedObject.radius. This works, but when I add a deeper path to the mix (ex. representedObject.material.refractionIndex), I get the following message in the console when the selection changes: 2008-04-06 22:35:40.095 RayT[14429:10b] Cannot remove an observer NSKeyValueObservance 0x11434b1c0 for the key path material.refractionIndex from _NSControllerObjectProxy 0x114329b30, most likely because the value for the key material has changed without an appropriate KVO notification being sent. Check the KVO-compliance of the _NSControllerObjectProxy class. The first selection works, but each selection change after that trigger this message. Since the applicable inspector views change, I set their representedObject just before adding them to the screen: [controllers makeObjectsPerformSelector:@selector(setRepresentedObject:) withObject:[configController selection]]; Where controllers is the list of inspector views and configController is the array controller. If I precede this by first setting the representedObject to nil, I get the message every other selection event, rather than every event. Can anyone help shed some light on this situation? Thank you, Jacob Lukas ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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]
[SOLVED] Re: NSViewController's representedObject and NSArrayController's selection don't mix?
The problem ended up being that the object returned by - [NSArrayController selection] is a private proxy object, which dynamically proxies the current selection of the array controller. This means that the views were trying to stop observing the current selection's relationships, rather than the previous selection's relationships. Since I wanted the NSMultipleValuesMaker behavior provided by the private proxy, I ended up solving this problem by implementing a proxy object that proxies to an array. I then gave the selectedObjects to this proxy object, and set the proxy as my view controller's representedObject each time the selection changes. This works beautifully. If anyone wants the source for my proxy class, I'd be happy to provide it (free for all use). Thank you, Jacob Lukas On Apr 6, 2008, at 22:52, Jacob Lukas wrote: I have a table of Core Data objects and a set of inspector views. Depending on the Class(es) of the selection in the table view, the set of inspector views changes. I managed the inspector views with NSViewControllers. The fields in the inspector view are bound to the view controller's representedObject -- ex. representedObject.radius. This works, but when I add a deeper path to the mix (ex. representedObject.material.refractionIndex), I get the following message in the console when the selection changes: 2008-04-06 22:35:40.095 RayT[14429:10b] Cannot remove an observer NSKeyValueObservance 0x11434b1c0 for the key path material.refractionIndex from _NSControllerObjectProxy 0x114329b30, most likely because the value for the key material has changed without an appropriate KVO notification being sent. Check the KVO-compliance of the _NSControllerObjectProxy class. The first selection works, but each selection change after that trigger this message. Since the applicable inspector views change, I set their representedObject just before adding them to the screen: [controllers makeObjectsPerformSelector:@selector(setRepresentedObject:) withObject:[configController selection]]; Where controllers is the list of inspector views and configController is the array controller. If I precede this by first setting the representedObject to nil, I get the message every other selection event, rather than every event. Can anyone help shed some light on this situation? Thank you, Jacob Lukas ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Creating Custom Views in Interface Builder
Whoops meant to hit Reply All On Mar 14, 2008, at 14:33, Michael Fey wrote: Hello List! I am trying to create a custom view class using Interface Builder that I can then instantiate within my code as many times as needed. In this particular case I have a control that I've created that contains a progress bar, two text fields, two buttons, and an image view. I then want to be able to create any number of these components within my source code and add them to another view dynamically. I'm guessing that this question has been answered before, but my searches have been unsuccessful. If someone could point me in the right direction, that would be a great help. Thanks! Regards, Michael What about creating this view in a separate nib, and loading it each time you wish to insert it somewhere? Perhaps using +[NSBundle loadNibNamed:owner:] -Jacob ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: [iPhone] xml parsing
On a similar-ish note, I'm having trouble using libxml. I'm using a slightly modified version of the appropriate sample code. I need to make sure that the library is in my project. Since I couldn't find the library in a convenient place (where are you supposed to get those anyway?), I just dragged it from the sample project to mine. However, when I try to build the project, it says it cannot locate libxml or libxml/tree.h or whatever I import. I can't find any significant differences in the projects' properties... does anyone know how to get this working? On Mar 10, 2008, at 4:46 PM, [EMAIL PROTECTED] wrote: If you find a function/method/class declaration in a public header (an header that is not in PrivateHeader folder) you can problably considere it as public. Le 10 mars 08 à 23:49, Simon Fell a écrit : The iPhone docs point you in the direction of libXML2 for parsing XML, yet the headers for NSXML are included in the SDK headers, and i was able to build and run fine using NSXMLDoc/element/node. (in fact i just dropped my existing NSXML based code into a iPhone project and it worked fine, so it never even occurred to me that this might not be supported). Would this constitute using a private API ? (is there a good definition of private API somewhere?) Tx Simon ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: [Moderator] iPhone discussion here - RETRACTION
So are we or are we not getting a specialized (password-protected, probably) discussion area for the iPhone SDK? On Mar 10, 2008, at 6:30 PM, [EMAIL PROTECTED] wrote: That sounds surprisingly plausible. I imagine a big speech bubble above the Apple campus that says, Well, I'm glad we got all our ducks in a row for that iPhone SDK release! Meanwhile, cute little baby ducks are running at everyone's feet, riding the elevators up and down, quacking during meetings, causing accidents on Infinite Loop, eating from the salad bowl in the Apple Cafe, and sitting on the CEO's head. But, that's just me. I blame the ducks. - d On Mar 10, 2008, at 7:55 PM, I. Savant wrote: While I was told to allow discussion here, I've now been told that discussion should not be allowed here. Oh, that's just MEAN! Somewhere in Cupertino, somebody's standing next to the big NDA switch in the iPhone room, giggling maniacally as they flip it on- off-on-off-... :-D -- I.S. PS: I blame Scott. So should everybody else. ;-) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: cascading windows in document architecture
On Feb 25, 2008, at 12:01, Boyd Collier wrote: Andrea, Thanks for the reply. In my case, the that aren't cascading are all of the same kind, i.e. just very plain text files. I've not yet figured out why this is happening, but perhaps someone will be able to point out something simple that we are overlooking. Boyd I had this problem as well. The fix for me was to not show the window during awakeFromNib, but rather let the window be cascaded and shown automatically. It seems that if the window is already visible before it has been cascaded, the cascading step is skipped. Hope this helps. -Jacob ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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]