Re: Custom send proc (migrated from cocoa-dev list)
On 20 Jan 2010, at 23:47, has wrote: The send proc callback (which should be installed prior to invoking the script and have the same signature as AESend) is called by the AS component whenever it needs to dispatch an Apple event. You can then do whatever naughtiness you like (including passing the call onto AESend proper). The send proc signature is an augmented version of the AESend signature. The original issue here was to detect errAENoUserInteraction and conditionaly transform a foundation tool into a foreground GUI. The custom send proc approach works well. Thanks for all your input. These scripts are often executed as remote instances (as an alternative to remote targeting using eppc). It would seem possible, rather than optionally enabling/disabling remote user interaction, to route the interacting event back over the network to the originating machine. AEFlattenDesc() and AEUnflattenDesc() provide AE serialisation services. Does this sound practicable - or do monsters wait in the weeds? /* * function MGSCustomSendProc */ OSErr MGSCustomSendProc( const AppleEvent *anAppleEvent, AppleEvent *aReply, AESendMode aSendMode, AESendPriority aSendPriority, long aTimeOutInTicks, AEIdleUPP anIdleProc, AEFilterUPP aFilterProc, long refCon ) { #pragma unused(refCon) OSErr result = noErr; // send the event as normal result = AESend(anAppleEvent, aReply, aSendMode, aSendPriority, aTimeOutInTicks, anIdleProc, aFilterProc); // // look for no user interaction required. // if the user interaction was disallowed then transform the process // into a foreground application // if (result == errAENoUserInteraction ![MGSAppleScriptRunner isForegroundApplication]) { // transform to foreground application to allow for user interaction if ([MGSAppleScriptRunner transformToForegroundApplication]) { // resend the event result = AESend(anAppleEvent, aReply, aSendMode, aSendPriority, aTimeOutInTicks, anIdleProc, aFilterProc); } } return result; } Thanks Jonathan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Ignore last two posts - misdirected
Sorry for the last two misdirected posts. Regards Jonathan Mitchell Developer http://www.mugginsoft.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSPredicateEditor Continuous updating failes
Hi LIst, i set up an NSPredicateEditor and got it all working fine except that it only executes when i hit enter or tab out of the NSTextField. Is there a way to let it execute everytime something changes in the textfield? I tried checking the continuous button in IB but that is impossible, it always unchecks itself. I also tried setting continuous programatically but to no avail... Anyone has any suggestions? Kind regards, Florian. Looking for Web-to-Print Solutions? Visit our website : http://www.vit2print.com This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information and/or information protected by intellectual property rights. If you are not the intended recipient, please note that any review, dissemination, disclosure, alteration, printing, copying or transmission of this e-mail and/or any file transmitted with it, is strictly prohibited and may be unlawful. If you have received this e-mail by mistake, please immediately notify the sender and permanently delete the original as well as any copy of any e-mail and any printout thereof. We may monitor e-mail to and from our network. NSS nv Tieltstraat 167 8740 Pittem Belgium ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Correct Bindings Practices
On Jan 20, 2010, at 19:51, Chase Meadors wrote: I have a couple of questions about the practices I'm using for bindings in my app. 1. Doing work in the setter: Something I do alot when making models custom views. For example, I might have a layer subclass that exposes a binding called concentration. I @synthesize the property, but I override the setter to do all the work involving calculations, modifying sublayers, colors, etc. Is this a common practice, or is there some other way I should be doing it? Your terminology seems incorrect. A binding is not the same thing as a property. Do you mean property when you say binding? There's nothing wrong with overriding (just) the setter to do stuff, that's what it's for. However, it's not clear whether your layers are user interface objects or data model objects. If this is some sort of drawing application, it would make sense for (conceptual) layers, colors, etc to be in your data model. 2. Work in progress objects: I have a model object that exposes only an array as it's only binding. The model manages text files and reads/modifies them in accordance to it's array binding. Since adding an object to an array could be potentially large process, I want to let the user construct an object before ever adding it to the array. I've solved this by simply letting my controller have possession of a thingToAdd object that the user can change and modify. Then the add button will cause the controller to actually set the new array on the model. Again, is this a common practice? You mean property again, instead of binding? It's usually helpful to think of a property like this as an *indexed* property rather than an *array* property, because the actual array is an implementation detail that you do *not* want to reveal to clients of your data model. (If you do, they can just munge the array at will, which would probably upset your data model greatly.) In a case like this, you can provide an array proxy (such as [modelObject mutableArrayValueForKey:@indexPropertyKey]) as the indexed property value, and implement the standard indexed KVC accessors to control what clients can actually do with it. Having the controller be guardian of the thingToAdd object doesn't seem like a terrible idea, though it might be plausible to have the data model be the guardian instead, especially if you might like to *save* the partially constructed object with the rest of the data -- so the user doesn't have to reconfigure it construction is interrupted by some other activity -- or if the guardianship requires some knowledge of the internals of the object that the controller really shouldn't have. The other issue that needs care in regard to both your questions is undo. When setters do a lot of work, you need to be careful about what happens at undo or redo time. Plus, if you want the thingToAdd construction steps to be undoable, that again might be a reason to put the special object in the data model with the rest of the undoable things, rather than in the controller. (Or not -- it's hard to say in general.) FWIW ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
NSRulerView and inches
Hi all, I'm been involved with an app that has the ability to create documents in various dimensions, including a way where you specify the width and height in inches + the PPI. So, for example, the user can specify a document of size 5in x 5in with 300 PPI. From this definition, I'll have a document of size 1500 points by 1500 points although I'll have to redefine how many points equal one inch for the ruler view. As NSRulerView already has the definition of 1 inch = 72 points, am I right that I'll have to create a new unit with a random name (could use a UUID) and in abbreviation that's defined from the PPI selected by the user? So, in the example case I'll send a msg similar to [NSRulerView registerUnitWithName:@random unused unit name abbreviation:NSLocalizedString(@in, @Inches abbreviation string) unitToPointsConversionFactor:300.0 stepUpCycle:upArray stepDownCycle:downArray]. Thanks, M___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Standard Alert Note/Warning/Stop icon NSImage Names?
On 30.08.2009, at 03:45, Nick Zitzmann wrote: On Aug 29, 2009, at 6:24 PM, Seth Willits wrote: Are the standard alert icons (note, warning, and stop) available through standard image names (like NSApplicationIcon)? They don't seem to be. There are, and they're available through standard image names. But you have to use IconRef, not NSImage, to get those icons. See IconsCore.h for details. I know I'm half a year late on this thread, but there is another way: IIRC, you can use NSFileTypeForHFSTypeCode(), passing in the warning icon constant from Icon Services, and then pass that to NSWorkspace's -iconForFileType:. In that case, at least you'd get an NSImage right away. -- Uli Kusterer The Witnesses of TeachText are everywhere... http://www.masters-of-the-void.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
initialize a store with default data core data
Hello. I was reading the Apple docs, and in the FAQ it says that I must check for : f you are using a non-document-based application and started with the standard application template then after these lines of code: if ( ![fileManager fileExistsAtPath:applicationSupportFolder isDirectory:NULL] ) { [fileManager createDirectoryAtPath:applicationSupportFolder attributes:nil]; } url = [NSURL fileURLWithPath: [applicationSupportFolder stringByAppendingPathComponent: @Delete.xml]]; you can add a check to determine whether the file at the url exists. If it doesn't, you need to import the data. now I have the following: if ( ![fileManager fileExistsAtPath:applicationSupportDirectory isDirectory:NULL] ) { if (![fileManager createDirectoryAtPath:applicationSupportDirectory withIntermediateDirectories:NO attributes:nil error:error]) { NSAssert(NO, ([NSString stringWithFormat:@Failed to create App Support directory %@ : %@, applicationSupportDirectory,error])); NSLog(@Error creating application support directory at %@ : %@,applicationSupportDirectory,error); return nil; } } NSURL *url = [NSURL fileURLWithPath: [applicationSupportDirectory stringByAppendingPathComponent: @iZivnostData]]; //The iZivnostData doesn't exists, so Im gonna import the status if(url){ NSString * pListPath = [[NSBundle mainBundle] pathForResource:@Status ofType:@plist]; NSDictionary * statusDic = [[NSDictionary alloc] initWithContentsOfFile:pListPath]; NSEnumerator * enume = [statusDic keyEnumerator]; id key; while(key = [enume nextObject]){ //Iterate the enumerator to set teh InvoiceStatus //Status * stat = [NSEntityDescription entityForName:@Status inManagedObjectContext:mom]; //NSDictionary * internalDic = [statusDic valueForKey:(NSString*)key]; } [statusDic release]; //REleasing the Dictionary } persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel: mom]; //Handling autoversioning NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil]; if (![persistentStoreCoordinator addPersistentStoreWithType:NSXMLStoreType configuration:nil URL:url options:options error:error]){ [[NSApplication sharedApplication] presentError:error]; [persistentStoreCoordinator release], persistentStoreCoordinator = nil; return nil; } return persistentStoreCoordinator; What is in bold is where I read the plist file and if I understand fine I can import the new data.. BUT ... as you can see I commented the internal while loop, because I need to have a NSManagedObjectContext, which at this point I don't have.. .. I dunno what I did'nt get form the docs.. what am I missing to do.. ? If I call the [self managedObjectContext] method, this method will as for the persistentStorCoordinator which at this point it doesn't exist yet... what to do then? Best regards thanks a lot. Gustavo Pizano___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSDrawNinePartImage autorelease problem
i thought that aswell, but i have another user reporting the same problem, this time running 10.5.8 with a slightly different crash report, which i have added below. the crash only occurs for outgoing messages, you can see the whole code here: http://code.google.com/p/isoul/source/browse/trunk/iSoul/Code/Views/BubbleTextView.m can anyone offer any insight? i cannot understand how if all the inputs to NSDrawNinePartImage are retained this problem should be occurring. OS Version: Mac OS X 10.5.8 (9L31a) Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0020 Crashed Thread: 0 Thread 0 Crashed: 0 libobjc.A.dylib 0x7fff8458cced _objc_fixupMessageRef + 34 1 libobjc.A.dylib 0x7fff8458ec7f objc_msgSend_fixup + 119 2 com.apple.AppKit0x7fff827d7144 _NSDrawNinePartImage + 1331 3 com.apple.AppKit0x7fff829f0575 NSDrawNinePartImage + 580 4 com.bdp.iSoul 0x000100025054 -[BubbleTextView drawBubbleAroundTextInRect:user:outgoing:] + 1082 5 com.bdp.iSoul 0x000100025819 -[BubbleTextView drawViewBackgroundInRect:] + 1248 6 com.apple.AppKit0x7fff82760308 -[NSTextView drawRect:] + 375 7 com.apple.AppKit0x7fff8275ffb2 -[NSTextView _drawRect:clip:] + 2580 8 com.apple.AppKit0x7fff826f81b4 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 2204 9 com.apple.AppKit0x7fff826f8bfb -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4835 10 com.apple.AppKit0x7fff826f8bfb -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4835 11 com.apple.AppKit0x7fff826f8bfb -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4835 12 com.apple.AppKit0x7fff826f8bfb -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4835 13 com.apple.AppKit0x7fff826f8bfb -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4835 14 com.apple.AppKit0x7fff826f8bfb -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4835 15 com.apple.AppKit0x7fff826f8bfb -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4835 16 com.apple.AppKit0x7fff826f8bfb -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4835 17 com.apple.AppKit0x7fff826f8bfb -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4835 18 com.apple.AppKit0x7fff826f8bfb -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4835 19 com.apple.AppKit0x7fff826f8bfb -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4835 20 com.apple.AppKit0x7fff826f74e4 -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 328 21 com.apple.AppKit0x7fff826f3d4a -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 3008 22 com.apple.AppKit0x7fff82631617 -[NSView displayIfNeeded] + 1190 23 com.apple.AppKit0x7fff8263110c -[NSWindow displayIfNeeded] + 82 24 com.apple.AppKit0x7fff82630f9c _handleWindowNeedsDisplay + 417 25 com.apple.CoreFoundation0x7fff8479e3ea __CFRunLoopDoObservers + 506 26 com.apple.CoreFoundation0x7fff8479f6b4 CFRunLoopRunSpecific + 836 27 com.apple.HIToolbox 0x7fff822a3d0e RunCurrentEventLoopInMode + 278 28 com.apple.HIToolbox 0x7fff822a3b44 ReceiveNextEventCommon + 322 29 com.apple.HIToolbox 0x7fff822a39ef BlockUntilNextEventMatchingListInMode + 79 30 com.apple.AppKit0x7fff8262ee70 _DPSNextEvent + 603 31 com.apple.AppKit0x7fff8262e7b1 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 136 32 com.apple.AppKit0x7fff82628523 -[NSApplication run] + 434 33 com.apple.AppKit0x7fff825f52f0 NSApplicationMain + 373 34 com.bdp.iSoul 0x00011c04 start + 52 On Tue, Jan 19, 2010 at 9:55 AM, Matt Gough
Re: NSPredicateEditor Continuous updating failes
On Thu, Jan 21, 2010 at 6:00 AM, Florian Soenens florian.soen...@nss.be wrote: Hi LIst, i set up an NSPredicateEditor and got it all working fine except that it only executes when i hit enter or tab out of the NSTextField. Is there a way to let it execute everytime something changes in the textfield? I tried checking the continuous button in IB but that is impossible, it always unchecks itself. I also tried setting continuous programatically but to no avail... Anyone has any suggestions? Kind regards, Florian. Add an observer for notifications of NSControlTextDidChangeNotification. When the predicate editor updates a text field, it'll send this notification with itself as the object value. -- Jim http://nukethemfromorbit.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: initialize a store with default data core data
Hello, this is what Im doing now... I mistake before... is it ok if I do what Im doing here? if(url){ managedObjectContext = [[NSManagedObjectContext alloc] init]; [managedObjectContext setPersistentStoreCoordinator:persistentStoreCoordinator]; NSString * pListPath = [[NSBundle mainBundle] pathForResource:@Status ofType:@plist]; NSDictionary * statusDic = [[NSDictionary alloc] initWithContentsOfFile:pListPath]; NSEnumerator * enume = [statusDic keyEnumerator]; id key; while(key = [enume nextObject]){ //Iterate the enumerator to set teh InvoiceStatus Status * stat = [NSEntityDescription insertNewObjectForEntityForName:@Status inManagedObjectContext:managedObjectContext]; NSDictionary * internalDic = [statusDic valueForKey:(NSString*)key]; ... ... } [statusDic release]; //REleasing the Dictionary } On Jan 21, 2010, at 2:38 PM, Gustavo Pizano wrote: Hello. I was reading the Apple docs, and in the FAQ it says that I must check for : f you are using a non-document-based application and started with the standard application template then after these lines of code: if ( ![fileManager fileExistsAtPath:applicationSupportFolder isDirectory:NULL] ) { [fileManager createDirectoryAtPath:applicationSupportFolder attributes:nil]; } url = [NSURL fileURLWithPath: [applicationSupportFolder stringByAppendingPathComponent: @Delete.xml]]; you can add a check to determine whether the file at the url exists. If it doesn't, you need to import the data. now I have the following: if ( ![fileManager fileExistsAtPath:applicationSupportDirectory isDirectory:NULL] ) { if (![fileManager createDirectoryAtPath:applicationSupportDirectory withIntermediateDirectories:NO attributes:nil error:error]) { NSAssert(NO, ([NSString stringWithFormat:@Failed to create App Support directory %@ : %@, applicationSupportDirectory,error])); NSLog(@Error creating application support directory at %@ : %@,applicationSupportDirectory,error); return nil; } } NSURL *url = [NSURL fileURLWithPath: [applicationSupportDirectory stringByAppendingPathComponent: @iZivnostData]]; //The iZivnostData doesn't exists, so Im gonna import the status if(url){ NSString * pListPath = [[NSBundle mainBundle] pathForResource:@Status ofType:@plist]; NSDictionary * statusDic = [[NSDictionary alloc] initWithContentsOfFile:pListPath]; NSEnumerator * enume = [statusDic keyEnumerator]; id key; while(key = [enume nextObject]){ //Iterate the enumerator to set teh InvoiceStatus //Status * stat = [NSEntityDescription entityForName:@Status inManagedObjectContext:mom]; //NSDictionary * internalDic = [statusDic valueForKey:(NSString*)key]; } [statusDic release]; //REleasing the Dictionary } persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel: mom]; //Handling autoversioning NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil]; if (![persistentStoreCoordinator addPersistentStoreWithType:NSXMLStoreType configuration:nil URL:url options:options error:error]){ [[NSApplication sharedApplication] presentError:error]; [persistentStoreCoordinator release], persistentStoreCoordinator = nil; return nil; } return persistentStoreCoordinator; What is in bold is where I read the plist file and if I understand fine I can import the new data.. BUT ... as you can see I commented the internal while loop, because I need to have a NSManagedObjectContext, which at this point I don't have.. .. I dunno what I did'nt get form the docs.. what am I missing to do.. ? If I call the [self managedObjectContext] method, this method will as for the persistentStorCoordinator which at this point it doesn't exist yet... what to do then? Best regards thanks a lot. Gustavo Pizano ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
NSHost and NSStream question
Hi Cocoa developers, I am writing a small application that acts as a TCP client for another application (TCP server). The client nows the IP address and port of the server. I then use NSStream to create an output stream from an NSHost (see code bellow). If I initialize the IP address as 127.0.0.1, or my own 192.168.1.x address, it creates the NSHost and NSOutputStream properly, but I always get a connection refused error. Does anybody see what I am doing wrong here ? Thanks! Mathieu NSHost* host = [NSHost hostWithAddress:@127.0.0.1]; [NSStream getStreamsToHost:host port:5000 inputStream:nil outputStream:outputStream]; [self setOutputStream:outputStream]; [outputStream setProperty:NSStreamSocketSecurityLevelNegotiatedSSL forKey:NSStreamSocketSecurityLevelKey]; [outputStream setDelegate:self]; [outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [outputStream open];___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Bindings: NSMutableArray - NSArrayController - NSPopUp
Thank you, Ken. It sounds like you're saying that everything may technically be getting linked up so that it would work, except I must be switching the array out in a non-KVO-compliant manner, so bound objects don't get notified of the change. Your reply gives me some ideas for experimentation. :-) On 2010-01-20 14:15, Ken Thomases wrote: For your original question, I think the issue is how it gets handed the list of games and how it makes the array available with -gameList. (As you can guess, I'm not sure what it refers to in your explanation.) The bindings are re-established from the NIB during NIB loading. If you change the gameList property of the object which is serving as the NIB's owner in a non-KVO-compliant manner after that point, then the binding for the array controller's content won't follow the update. I'm not sure if -setContent: on the array controller works. In fact, I doubt it does. If we use the Content Object binding of an array controller as a guide, then the content object has to be another array controller. It makes sense to bind the array controller's Content Array binding to the gameList property of File's Owner, as you have done. It's just that you have to make sure you're only mutating that property in a KVO-compliant manner. Regards, Ken On Jan 20, 2010, at 12:01 PM, Charles Jenkins wrote: Okay, let me rephrase my question... If I get a pointer to the NSArrayController and then call [myArrayController setContent:gameList], then should the array controller just work? In other words, if the game descriptions do not appear in my NSPopUp, then the problem just about has to be in the binding of the NSPopUp to the array controller, right? On 2010-01-17 15:17, Charles Jenkins wrote: I am struggling with bindings. I have worked through the examples in the Hillegass book, but it seems that none of the examples using NSPopUp quite matches what I need. In my app, just before a view appears, it gets handed a list of games in an NSMutableArray. It makes the array available with -(NSMutableArray*)gameList. I want the NSPopUp to contain a list showing the value of -(NSString*)description for each item in the list. I thought I was supposed to do this by adding an NSArrayController to my .nib file, and then making the following bindings: Array Controller's Content Array = File's Owner.gameList NSPopUp's Content = Array Controller.arrangedObjects At runtime I get a totally empty popup. I can imagine two possibilities for why it doesn't work: a) I've got the bindings wrong b) The array controller can't handle the fact that the gameList pointer changes right before the view gets shown Can anyone help me get this working? --- Just in case it helps pre-answer any questions you may have, here are minimal descriptions of my classes: @interface GameScores { } -(NSString*)description; @end @interface GameViewController { NSMutableArray* gameList; } @property (retain) NSMutableArray* gameList; @end In the .nib file, NSArrayController tries to manage File's Owner.gameList, and the NSPopUp is supposed to display the NSArrayControler's arrangedObjects. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/cjenkins%40tec-usa.com This email sent tocjenk...@tec-usa.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/ken%40codeweavers.com This email sent to...@codeweavers.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: Unable to recieve mouse moved events on NSBorderless window
I added the NSTracking area for view it works. Thanks From: cocoa-dev-bounces+poonamshigihalli=tataelxsi.co...@lists.apple.com on behalf of Andy Lee Sent: Thu 1/21/2010 11:54 AM To: Quincey Morris Cc: cocoa-dev Subject: Re: Unable to recieve mouse moved events on NSBorderless window On Jan 20, 2010, at 5:05 PM, Quincey Morris wrote: On Jan 20, 2010, at 05:33, Poonam Virupaxi Shigihalli wrote: I am using NSBorderless window style mask for window to set in full screen mode. I am unable to recieve the mouse moved event on borderless window. If I set the window style mask to titled I am able to recieve mouse moved events. I have set in awake from nib [window setAcceptsMouseMovedEvents:YES]; And using mousemoved: function to detect the event. This is not an answer to your actual question (apart from noting that window behavior is famous for being different in non-standard window configurations), but you might be able to bypass your problem by using NSTrackingArea (Leopard and later) instead. The side benefit of this is that tracking mouse movements with tracking areas is (likely) somewhat more efficient overall than using the older almost-deprecated 'setAcceptsMouseMovedEvents:YES' technique. I dealt with a similar problem recently (though not so recently that I remember the details), and going with NSTrackingArea was the solution. I discovered that the setAcceptsMouseMovedEvents: technique only works with the key window or with views that are first responder, or something like that. I'm pretty sure something in the list archives got me on the right track, possibly this: http://www.cocoabuilder.com/archive/cocoa/31206-capture-mousemoved-under-nsview.html#31201. --Andy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/poonamshigihalli%40tataelxsi.co.in This email sent to poonamshigiha...@tataelxsi.co.in ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
iPhone: question about orientation
I am sending a view orientation data which works great, if the phone is held up... UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; if( orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight ){ [myView iAmLandscape:YES]; } else if(orientation == UIDeviceOrientationPortrait) { [myView iAmLandscape:NO]; } However if I have the phone angled back almost flat in my hand, it isn't caught ... UIDeviceOrientationFaceUp and UIDeviceOrientationFaceDown seem to screw this up. When some people use their phone, they hold it flat in their hand which seems to produce an orientation of face up, but doesn't provide portrait or landscape information. What's the best way to tackle 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 arch...@mail-archive.com
Uploading image via HTTP POST
My project goal is to upload photos to Tumblr using the Tumblr API found here: http://www.tumblr.com/docs/api#api_write I can upload general HTML content no problem but when I attempt to upload a photo I get stumped. The API docs say: Normal POST method, in which the file's entire binary contents are URL-encoded like any other POST variable. Maximum size: • 5 MB for videos • 5 MB for photos • 5 MB for audio So I'm trying to get the binary contents of the image according to the API. In my view controller class, I have the following code: NSData *imageData = [image TIFFRepresentation]; NSBitmapImageRep * bitmap; bitmap = [NSBitmapImageRep imageRepWithData:imageData]; NSData *pngData = [bitmap representationUsingType:NSPNGFileType properties:nil]; The pngData is sent to the Tumblr post class where I try to upload it. postType = @photo; NSData *imageData = [dataToPost objectForKey:@image]; //Comes from view controller pngData variable request_body = [NSString stringWithFormat:@email=%@password=%@type=%@data=%@, [email stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], [password stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], [postType stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], [[NSString alloc] initWithData:imageData encoding:NSUTF8StringEncoding]]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@http://www.tumblr.com/api/write;]]; [request setHTTPMethod:@POST]; [request setHTTPBody:[request_body dataUsingEncoding:NSUTF8StringEncoding]]; NSURLConnection * theConnection=[[NSURLConnection alloc] initWithRequest:request delegate:self]; The problem is that I can't figure out how to upload the data. I have tried a number of ways but I usually get a Server Response Code 403 - Bad Request. To the best of my knowledge, image data won't convert to NSUTF8StringEncoding-- but how can I fit the data in to the HTTPBody for Tumblr servers to accept? Thanks for your help!___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
writeToFile for memory mapped NSData
I have an instance of NSData is created using dataWithContentsOfMappedFile: and then written to a different file using writeToFile:atomically:. In many cases there are no calls that would cause the file to be read in between those two operations. In those cases does the entire file get read into memory and then written, or is the implementation smart enough to just do the disk copy? That is, is it significantly more efficient to use NSFileManager to do a copy when no manipulation of the data is needed? Thanks, -Andy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: iPhone: question about orientation
UIViewcontroller with autorotation is the best way to do this. Then you don't need to deal with UIDevice orientations. Luke Sent from my iPhone. On Jan 21, 2010, at 8:30 AM, Eric E. Dolecki edole...@gmail.com wrote: I am sending a view orientation data which works great, if the phone is held up... UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; if( orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight ){ [myView iAmLandscape:YES]; } else if(orientation == UIDeviceOrientationPortrait) { [myView iAmLandscape:NO]; } However if I have the phone angled back almost flat in my hand, it isn't caught ... UIDeviceOrientationFaceUp and UIDeviceOrientationFaceDown seem to screw this up. When some people use their phone, they hold it flat in their hand which seems to produce an orientation of face up, but doesn't provide portrait or landscape information. What's the best way to tackle 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/luketheh%40apple.com This email sent to luket...@apple.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: iPhone: question about orientation
Wouldn't autorotation fall into the same category of problem? Should I also look into device rotation in tandem with orientation just in case orientation fails? On Thu, Jan 21, 2010 at 12:17 PM, Luke Hiesterman luket...@apple.comwrote: UIViewcontroller with autorotation is the best way to do this. Then you don't need to deal with UIDevice orientations. Luke Sent from my iPhone. On Jan 21, 2010, at 8:30 AM, Eric E. Dolecki edole...@gmail.com wrote: I am sending a view orientation data which works great, if the phone is held up... UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; if( orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight ){ [myView iAmLandscape:YES]; } else if(orientation == UIDeviceOrientationPortrait) { [myView iAmLandscape:NO]; } However if I have the phone angled back almost flat in my hand, it isn't caught ... UIDeviceOrientationFaceUp and UIDeviceOrientationFaceDown seem to screw this up. When some people use their phone, they hold it flat in their hand which seems to produce an orientation of face up, but doesn't provide portrait or landscape information. What's the best way to tackle 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/luketheh%40apple.com This email sent to luket...@apple.com -- http://ericd.net Interactive design and development ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: iPhone: question about orientation
If you use autorotation you guarantee that your own app's rotation follows the same patterns of the system apps and thereby what the user is used to and expects. While a flat phone is by nature ambiguous from an interface orientation perspective, following the system's lead is the best path here. Luke Sent from my iPhone. On Jan 21, 2010, at 9:36 AM, Eric E. Dolecki edole...@gmail.com wrote: Wouldn't autorotation fall into the same category of problem? Should I also look into device rotation in tandem with orientation just in case orientation fails? On Thu, Jan 21, 2010 at 12:17 PM, Luke Hiesterman luket...@apple.com wrote: UIViewcontroller with autorotation is the best way to do this. Then you don't need to deal with UIDevice orientations. Luke Sent from my iPhone. On Jan 21, 2010, at 8:30 AM, Eric E. Dolecki edole...@gmail.com wrote: I am sending a view orientation data which works great, if the phone is held up... UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; if( orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight ){ [myView iAmLandscape:YES]; } else if(orientation == UIDeviceOrientationPortrait) { [myView iAmLandscape:NO]; } However if I have the phone angled back almost flat in my hand, it isn't caught ... UIDeviceOrientationFaceUp and UIDeviceOrientationFaceDown seem to screw this up. When some people use their phone, they hold it flat in their hand which seems to produce an orientation of face up, but doesn't provide portrait or landscape information. What's the best way to tackle 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/luketheh%40apple.com This email sent to luket...@apple.com -- http://ericd.net Interactive design and development ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: iPhone: question about orientation
Okay, that's what I am doing right now. Only in one circumstance will my app require the device to change orientation for it to look correct so I guess that's not too terribly bad. Eric On Thu, Jan 21, 2010 at 12:47 PM, Luke Hiesterman luket...@apple.comwrote: If you use autorotation you guarantee that your own app's rotation follows the same patterns of the system apps and thereby what the user is used to and expects. While a flat phone is by nature ambiguous from an interface orientation perspective, following the system's lead is the best path here. Luke Sent from my iPhone. On Jan 21, 2010, at 9:36 AM, Eric E. Dolecki edole...@gmail.com wrote: Wouldn't autorotation fall into the same category of problem? Should I also look into device rotation in tandem with orientation just in case orientation fails? On Thu, Jan 21, 2010 at 12:17 PM, Luke Hiesterman luket...@apple.com luket...@apple.com wrote: UIViewcontroller with autorotation is the best way to do this. Then you don't need to deal with UIDevice orientations. Luke Sent from my iPhone. On Jan 21, 2010, at 8:30 AM, Eric E. Dolecki edole...@gmail.com edole...@gmail.com wrote: I am sending a view orientation data which works great, if the phone is held up... UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; if( orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight ){ [myView iAmLandscape:YES]; } else if(orientation == UIDeviceOrientationPortrait) { [myView iAmLandscape:NO]; } However if I have the phone angled back almost flat in my hand, it isn't caught ... UIDeviceOrientationFaceUp and UIDeviceOrientationFaceDown seem to screw this up. When some people use their phone, they hold it flat in their hand which seems to produce an orientation of face up, but doesn't provide portrait or landscape information. What's the best way to tackle this? ___ Cocoa-dev mailing list ( Cocoa-dev@lists.apple.com Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at) http://lists.apple.com lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com This email sent to luket...@apple.comluket...@apple.com -- http://ericd.nethttp://ericd.net Interactive design and development -- http://ericd.net Interactive design and development ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Application crashes
On 1/19/10 6:34 PM, yogin bhargava said: HI All, I have a cocoa application. Rarely it crashes with the following log crash messages : Thread 0 Crashed: 0 libobjc.A.dylib 0x93960699 objc_msgSend + 41 Have you read this: http://www.sealiesoftware.com/blog/archive/2008/09/22/ objc_explain_So_you_crashed_in_objc_msgSend.html -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSOutlineView + selectionIndexPaths binding
On Jan 20, 2010, at 20:17, Andrew Shamel wrote: I have an NSOutlineView with its only column bound at treeController.arrangedObjects.name to an NSTreeController that manages a Core Data entity called Collection with the property name. The NSOutlineView's dataSource IBOutlet is connected to a custom class CollectionViewController for the purposes of handling drag and drop. What I would like to do is bind the NSOutlineView's selectionIndexPaths binding to the NSTreeController's selectionIndexPaths key. When I do this, however, I get back this error: Illegal NSOutlineView data source (CollectionViewController: 0x1001722d0). Must implement outlineView:numberOfChildrenOfItem:, outlineView:isItemExpandable:, outlineView:child:ofItem: and outlineView:objectValueForTableColumn:byItem: and there is nothing in the NSOutlineView (or any other bound views for that matter). I tried implementing dummy versions of those NSOutlineViewDataSource methods (that return negative or nil values), as I have seen recommended in the archives, but this also results in a host of empty views. Have there been any developments on this front? Is there any way to bind the selectionIndexPaths binding while still using bindings for the NSOutlineView's data? Your problem is nothing to do with selectionIndexPaths, but rather how you're using the data source. Table outline views have a content binding, which is an alternative to using a data source. If you provide neither binding nor data source (which is the typical case), then the view figures it out from the bindings of the columns themselves. In your case, you've explicitly specified a data source, so the column binding is *just* the column binding. You must fully implement the data source methods, and they have to return real data. The only shortcut you can take is that 'outlineView:objectValueForTableColumn:byItem:' isn't actually going to be called -- since you only have one column, and *its* data is coming from its own binding. Of course, if you've got to implement almost all of the data source anyway, then it might be easier to add the last piece and feed the column through the data source instead of a binding. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSRulerView and inches
On Jan 21, 2010, at 04:30, Milen Dzhumerov wrote: I'm been involved with an app that has the ability to create documents in various dimensions, including a way where you specify the width and height in inches + the PPI. So, for example, the user can specify a document of size 5in x 5in with 300 PPI. From this definition, I'll have a document of size 1500 points by 1500 points although I'll have to redefine how many points equal one inch for the ruler view. As NSRulerView already has the definition of 1 inch = 72 points, am I right that I'll have to create a new unit with a random name (could use a UUID) and in abbreviation that's defined from the PPI selected by the user? So, in the example case I'll send a msg similar to [NSRulerView registerUnitWithName:@random unused unit name abbreviation:NSLocalizedString(@in, @Inches abbreviation string) unitToPointsConversionFactor:300.0 stepUpCycle:upArray stepDownCycle:downArray]. No, the first P in PPI isn't points but pixels. A 5in x 5in x 300 PPI document is 1500 pixels by 1500 pixels. By contrast, rulers work in [Postscript] points -- 1/72.0 in. Registering a new unit with the parameters you describe would make your inches 4 times too large, approximately. It doesn't look like you need any new ruler definitions for your situation. In your data model, keep your sizes and locations in whatever units make the most sense, then expect to *transform* the values to view units (which depend, at least, on the view's zoom factor). In general, it's awkward to let the view do the scaling automatically (by manipulating the relationship between its bounds and its frame), because you often want to draw your view contents scaled in both size and location, but your UI widgetry (such as selection handles) using unscaled sizes on scaled locations. The details depend on your application, but it's vital to start by clearing separating the data model coordinate system from the view's logical and actual coordinate systems. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Uploading image via HTTP POST
On Jan 21, 2010, at 8:39 AM, Daniel Meachum wrote: [[NSString alloc] initWithData:imageData encoding:NSUTF8StringEncoding]]; That's not going to work. Not all series of bytes are valid UTF-8, and in non-textual data like an image you're practically guaranteed to run into illegal UTF-8 sequences pretty quickly. The result will be a nil NSString. If you want a string encoding that supports arbitrary byte values, try NSWindowsCP1252StringEncoding, which is the default encoding used on Windows. (It's a superset of ISO-8859 that includes encodings for 80-9F.) You also haven't done any URL-encoding of the resulting string. Call stringByAddingPercentEscapesUsingEncoding: on the resulting string, but use NSWindowsCP1252StringEncoding as the encoding parameter (or whatever other 8-bit encoding you used.) —Jens PS: Off-topic, I can't believe the Tumblr engineers invented a protocol that's going to almost triple the size of the image data. It's not REST, or even the normal way that HTTP forms upload file attachments. Sigh. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSHost and NSStream question
On Jan 21, 2010, at 6:43 AM, Mathieu Coursolle wrote: If I initialize the IP address as 127.0.0.1, or my own 192.168.1.x address, it creates the NSHost and NSOutputStream properly, but I always get a connection refused error. What's the exact error domain and code? Since SSL is involved, are you sure the server's certificate is acceptable, i.e. unexpired and authorized by a root cert that's known to OS X? (It's possible to get CFNetwork to accept other certs, but you have to set some other properties.) —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
Unexpected PDFKit behavior in -[PDFPage string]
Dear Cocoa-dev People, In PDFKit NSString * currentPageData = [currentPage string]; behaves quite differently on a Snow Leopard build than it did under Leopard. A partial description of the issue is that the order of table data in not correctly preserved under Snow Leopard. Has anyone else noticed this issue? I thought it prudent to query the list before filing a rdar. Sincerely, Joel P.S. My heartfelt gratitude to Bertrand Mansion for resurrecting the awesome cocoabuilder site! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Accepting and Responding to Keystrokes
Hey everyone, I'm a newbie and I have what I anticipate will be a pretty easy question to answer. In order to learn a bit about event handling and drawing, I'm attempting to write a program that draws a black rectangle that increases in length every time the user hits the 'c' key. So far it just draws a black rectangle on a blue background without responding to keystrokes. Here is what I have so far: Input.h #import Cocoa/Cocoa.h @interface Input : NSView { int length; } -(void)keyDown:(NSEvent *)theEvent; @end Input.m #import Input.h @implementation Input -(id)initWithFrame:(NSRect)frame { self = [super initWithFrame:frame]; length = 10; if (self) { //Initialization code here. } return self; } -(void)drawRect:(NSRect)dirtyRect { //set variables NSRect r1; NSBezierPath *bp; //set background color [[NSColor blueColor] set]; NSRectFill(dirtyRect); //set color to black draw r1 [[NSColor blackColor] set]; r1 = NSMakeRect(1, 1, length, 10); bp = [NSBezierPath bezierPathWithRect:r1]; [bp fill]; } -(void)keyDown:(NSEvent *)theEvent { NSString *key = [theEvent characters]; if ( [key isEqualToString:@c] ) { length += 10; } } @end I copied the keyDown method from Cocoa in a Nutshell, by the way. Needless to say, I don't really understand it. Basically, I would love it if somebody could help me to get this program to work, because as of yet I have not gotten anything to respond to keystrokes. I believe that I need to make Input the First Responder, but I'm not sure about that and I don't know how to anyway...this seems as if this should be such a basic program to create, but it's giving me endless frustration. Please help! Also the only thing I've done in IB is add a Custom View and change its class identity to Input. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
CALayer resizing puzzle
Hi to all, I'm trying to write a (at that time) simple GIS-like application based on Cocoa. For each cartographic layer, I use a CALayer object, which is nice to control things like opacity in real-time. However, I'm facing a challenge: when the user move the mouse, the drawing must move accordingly, feeling in white spaces that appear when updating the position property. However, to feel in those spaces, the app must be able to draw on it, thus the layer shall be resizable in every four direction, including left and below, while maintaining the existing drawing unchanged. I've tried to move the anchor point around and modify bounds or frame, but to no avail: or I get no extension, or I have a transitory motion corresponding to a bound property change (is there a way to disable the implied CASimpleAnimation?). So, put briefly, is there a way to extend a CALayer in whatever direction while keeping its content unmoving? Thanks! Vincent___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CALayer resizing puzzle
Vincent, Do you have some code that you can show us? Otherwise, diagnosing your problem will be pure guesswork. regards, douglas However, I'm facing a challenge: when the user move the mouse, the drawing must move accordingly, feeling in white spaces that appear when updating the position property. However, to feel in those spaces, the app must be able to draw on it, thus the layer shall be resizable in every four direction, including left and below, while maintaining the existing drawing unchanged. I've tried to move the anchor point around and modify bounds or frame, but to no avail: or I get no extension, or I have a transitory motion corresponding to a bound property change (is there a way to disable the implied CASimpleAnimation?). So, put briefly, is there a way to extend a CALayer in whatever direction while keeping its content unmoving? Thanks! Vincent___ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[iPhone] Adding a UIView to current view
Hi List, I have a UIView (BubbleView) that I want to add to my current view (a loading splash screen). I have synthesized myBubble. I have a method that when called is suppose to add the view, but the view doesn't show up. I am not sure what I am missing ChapterViewController.h @interface ChapterViewController : UIViewController UIActionSheetDelegate { BubbleView *myBubble; } @property(nonatomic, retain )BubbleView *myBubble; ChapterViewController.m - (void) showLoading{ self.myBubble.frame = CGRectMake(30, 100, 260, 220); self.myBubble.backgroundColor = [UIColor clearColor]; CGRect contentRect = CGRectMake(35, 30, 240, 40); UILabel *textView = [[UILabel alloc] initWithFrame:contentRect]; textView.text = @Loading ...; textView.numberOfLines = 1; textView.textColor = [UIColor whiteColor]; textView.backgroundColor = [UIColor clearColor]; textView.font = [UIFont systemFontOfSize:22]; [self.myBubble addSubview:textView]; UIActivityIndicatorView * activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(110, 100, 50, 50)]; activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; [activityIndicator startAnimating]; [activityIndicator hidesWhenStopped]; [self.myBubble addSubview:activityIndicator]; [self.view addSubview:myBubble]; [activityIndicator release]; [textView release]; } Thanks for the help, Phil ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] Adding a UIView to current view
Standard first question: did you verify that myBubble is non-nil? Another note: it's weird that you do [self.view addSubview:myBubble] when through the rest of the method you always use self.myBubble. You should stick to using your property. Luke On Jan 21, 2010, at 3:33 PM, Philip Vallone wrote: Hi List, I have a UIView (BubbleView) that I want to add to my current view (a loading splash screen). I have synthesized myBubble. I have a method that when called is suppose to add the view, but the view doesn't show up. I am not sure what I am missing ChapterViewController.h @interface ChapterViewController : UIViewController UIActionSheetDelegate { BubbleView *myBubble; } @property(nonatomic, retain )BubbleView *myBubble; ChapterViewController.m - (void) showLoading{ self.myBubble.frame = CGRectMake(30, 100, 260, 220); self.myBubble.backgroundColor = [UIColor clearColor]; CGRect contentRect = CGRectMake(35, 30, 240, 40); UILabel *textView = [[UILabel alloc] initWithFrame:contentRect]; textView.text = @Loading ...; textView.numberOfLines = 1; textView.textColor = [UIColor whiteColor]; textView.backgroundColor = [UIColor clearColor]; textView.font = [UIFont systemFontOfSize:22]; [self.myBubble addSubview:textView]; UIActivityIndicatorView * activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(110, 100, 50, 50)]; activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; [activityIndicator startAnimating]; [activityIndicator hidesWhenStopped]; [self.myBubble addSubview:activityIndicator]; [self.view addSubview:myBubble]; [activityIndicator release]; [textView release]; } Thanks for the help, Phil ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com This email sent to luket...@apple.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] Adding a UIView to current view
Thank you Luke, That was it. Thanks, Phil On Jan 21, 2010, at 6:38 PM, Luke the Hiesterman wrote: Standard first question: did you verify that myBubble is non-nil? Another note: it's weird that you do [self.view addSubview:myBubble] when through the rest of the method you always use self.myBubble. You should stick to using your property. Luke On Jan 21, 2010, at 3:33 PM, Philip Vallone wrote: Hi List, I have a UIView (BubbleView) that I want to add to my current view (a loading splash screen). I have synthesized myBubble. I have a method that when called is suppose to add the view, but the view doesn't show up. I am not sure what I am missing ChapterViewController.h @interface ChapterViewController : UIViewController UIActionSheetDelegate { BubbleView *myBubble; } @property(nonatomic, retain )BubbleView *myBubble; ChapterViewController.m - (void) showLoading{ self.myBubble.frame = CGRectMake(30, 100, 260, 220); self.myBubble.backgroundColor = [UIColor clearColor]; CGRect contentRect = CGRectMake(35, 30, 240, 40); UILabel *textView = [[UILabel alloc] initWithFrame:contentRect]; textView.text = @Loading ...; textView.numberOfLines = 1; textView.textColor = [UIColor whiteColor]; textView.backgroundColor = [UIColor clearColor]; textView.font = [UIFont systemFontOfSize:22]; [self.myBubble addSubview:textView]; UIActivityIndicatorView * activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(110, 100, 50, 50)]; activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; [activityIndicator startAnimating]; [activityIndicator hidesWhenStopped]; [self.myBubble addSubview:activityIndicator]; [self.view addSubview:myBubble]; [activityIndicator release]; [textView release]; } Thanks for the help, Phil ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com This email sent to luket...@apple.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSRulerView and inches
On 22/01/2010, at 7:00 AM, Quincey Morris wrote: In your data model, keep your sizes and locations in whatever units make the most sense, then expect to *transform* the values to view units (which depend, at least, on the view's zoom factor). In general, it's awkward to let the view do the scaling automatically (by manipulating the relationship between its bounds and its frame), because you often want to draw your view contents scaled in both size and location, but your UI widgetry (such as selection handles) using unscaled sizes on scaled locations. Note that rulers automatically deal with the view's zoom so you don't normally have to factor that in manually. I'd say that letting the view do the scaling is definitely the easiest way to do it, through its -scaleUnitSquareToSize: method. It's true that elements such as selection handles and whatnot probably need to compensate for the view scale in the opposite direction, but it's probably better to apply that unzooming to the selection handles when they are drawn as a special case rather than the general scalable content. I also found that cancelling out the zoom altogether for handles is less usable than allowing them to scale in some proportion to the main zoom, e.g. at about 1/3rd the rate. That keeps them small enough not to block out the things they are associated with but still large enough to see and hit when zoomed in. A simple zoomable view class that I've used in a few projects now is here: http://apptree.net/gczoomview.htm --Graham___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Accepting and Responding to Keystrokes
On Jan 20, 2010, at 8:30 PM, Evan Schoenberg wrote: I copied the keyDown method from Cocoa in a Nutshell, by the way. Needless to say, I don't really understand it. Basically, I would love it if somebody could help me to get this program to work, because as of yet I have not gotten anything to respond to keystrokes. I believe that I need to make Input the First Responder, but I'm not sure about that and I don't know how to anyway... You also need to tell Cocoa that your view can accept keyboard focus: - (BOOL)canBecomeKeyView { return YES; } And in your nib you want to wire the window's initialKeyView outlet to your view, so it'll be key by default. Finally, The keyDown: method increases the length value, but it doesn't trigger a redraw of the view so this won't have any visible effect. After increasing length you need to call [self setNeedsDisplay: YES]; which tells the window that your view should be redrawn ASAP. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSRulerView and inches
On Thu, Jan 21, 2010 at 4:26 PM, Graham Cox graham@bigpond.com wrote: I'd say that letting the view do the scaling is definitely the easiest way to do it, through its -scaleUnitSquareToSize: method. It's true that elements such as selection handles and whatnot probably need to compensate for the view scale in the opposite direction, but it's probably better to apply that unzooming to the selection handles when they are drawn as a special case rather than the general scalable content. I also found that cancelling out the zoom altogether for handles is less usable than allowing them to scale in some proportion to the main zoom, e.g. at about 1/3rd the rate. That keeps them small enough not to block out the things they are associated with but still large enough to see and hit when zoomed in. I disagree wholeheartedly. I'd use automatic frame/bounds scaling for resolution independence, but manually track scale factors for zooming. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSRulerView and inches
On 22/01/2010, at 11:38 AM, Kyle Sluder wrote: I disagree wholeheartedly. I'd use automatic frame/bounds scaling for resolution independence, but manually track scale factors for zooming. Seems like I probably haven't made myself very clear then. What do you mean here by manually tracking? If I have a data model which is a drawing of some form, then letting the view handle the zoom on that data model is correct MVC - the drawing has a fixed coordinate system that never changes no matter what the view's zoom factor or even if there are multiple views of the same model having different zoom factors - the model doesn't need to know or care about the view(s). The only point in the system where the view's actual zoom is needed to be known is when drawing UI widgets such as selection handles, which as Quincey says, do not typically want to be drawn zoomed, so applying a scale factor of 1/zoom to these elements is needed. Since rulers automatically take into account a view's zoom to correctly display the underlying coordinate system at the correctly reported size, that suggests to me that Cocoa actively encourages you to take this approach. Surely any other design is going to be more work? I think we are talking at crossed purposes. If you have a very different architecture in mind, please explain it, because if I'm missing something obvious after all this time I'd dearly love to know about it! --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSRulerView and inches
On Thu, Jan 21, 2010 at 4:52 PM, Graham Cox graham@bigpond.com wrote: On 22/01/2010, at 11:38 AM, Kyle Sluder wrote: I disagree wholeheartedly. I'd use automatic frame/bounds scaling for resolution independence, but manually track scale factors for zooming. Seems like I probably haven't made myself very clear then. What do you mean here by manually tracking? I would have a separate zoomFactor property on my view, and use that inside -drawRect: to create a scaling transformation. Drawing UI adornments (resize handles, focus rings, etc.) at different sizes depending on zoom is bad UI, particularly when the user zooms out. And why bother rescaling it back to native size (and potentially dealing with rounding errors leading to non-integral coordinates and blurriness) when you could just avoid scaling it in the first place? If I have a data model which is a drawing of some form, then letting the view handle the zoom on that data model is correct MVC - the drawing has a fixed coordinate system that never changes no matter what the view's zoom factor or even if there are multiple views of the same model having different zoom factors - the model doesn't need to know or care about the view(s). The only point in the system where the view's actual zoom is needed to be known is when drawing UI widgets such as selection handles, which as Quincey says, do not typically want to be drawn zoomed, so applying a scale factor of 1/zoom to these elements is needed. Since rulers automatically take into account a view's zoom to correctly display the underlying coordinate system at the correctly reported size, that suggests to me that Cocoa actively encourages you to take this approach. There are lots of things Cocoa does for you automatically that are 80% solutions. NSController, anyone? Surely any other design is going to be more work? Yep, but it's the difference between good and good enough. I think we are talking at crossed purposes. If you have a very different architecture in mind, please explain it, because if I'm missing something obvious after all this time I'd dearly love to know about it! No, I think you understood me (or at least you were aware of the method I prefer). --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSRulerView and inches
On 22/01/2010, at 12:04 PM, Kyle Sluder wrote: I would have a separate zoomFactor property on my view, Yes, so would I... and use that inside -drawRect: to create a scaling transformation. OK understand, but why, when NSView does it for you using -scaleUnitSquareToSize:? Drawing UI adornments (resize handles, focus rings, etc.) at different sizes depending on zoom is bad UI, particularly when the user zooms out. And why bother rescaling it back to native size (and potentially dealing with rounding errors leading to non-integral coordinates and blurriness) when you could just avoid scaling it in the first place? Agree, if you always draw the resize handles at the same fixed size. However, I found that usability was improved noticeably when these elements are allowed to scale, but only in some smaller proportion of the main zoom factor. For example, I use 33% of the main zoom as the scale factor for resize handles, except if the view is zoomed out in which case a limit is applied so that the handles do not become smaller than a certain size. There's also a limit applied at the upper end as well. This makes sense for general graphic manipulation, though possibly not for every conceivable case however (e.g. I don't use focus rings as a highlighting method for content). I guess it's not going to make a huge difference whether you apply your own transform to the content drawing or let NSView do it, the content gets drawn correctly either way. However, if you do handle your own transform, doesn't the ruler scaling management become really painful? I'm just asking - I haven't tried this approach so I haven't explored what you have to do with the rulers to make this work. There are lots of things Cocoa does for you automatically that are 80% solutions. NSController, anyone? True, but in this case I haven't found a need to do much other than standard with NSRulerView. I just set the rulers to match my base coordinate system and it truly just works. No, I think you understood me (or at least you were aware of the method I prefer). Well, I do now. I think it's a relatively small difference after all - I thought you might have been talking about a much different approach, so thanks for the clarification. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSRulerView and inches
On Thu, Jan 21, 2010 at 5:37 PM, Graham Cox graham@bigpond.com wrote: OK understand, but why, when NSView does it for you using -scaleUnitSquareToSize:? Because it makes drawing things consistently at 1:1 resolution easier. Agree, if you always draw the resize handles at the same fixed size. However, I found that usability was improved noticeably when these elements are allowed to scale, but only in some smaller proportion of the main zoom factor. For example, I use 33% of the main zoom as the scale factor for resize handles, except if the view is zoomed out in which case a limit is applied so that the handles do not become smaller than a certain size. There's also a limit applied at the upper end as well. This makes sense for general graphic manipulation, though possibly not for every conceivable case however (e.g. I don't use focus rings as a highlighting method for content). I could see small/normal/large resize handles... I think Graffle makes the resize handles smaller when the object itself is small (due to geometry or zoom). But that's different from blithely drawing the resize handles at whatever scale AppKit has calculated for you. I guess it's not going to make a huge difference whether you apply your own transform to the content drawing or let NSView do it, the content gets drawn correctly either way. However, if you do handle your own transform, doesn't the ruler scaling management become really painful? I'm just asking - I haven't tried this approach so I haven't explored what you have to do with the rulers to make this work. My preferred solution: ditch NSRulerView. :) --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSTabViewDelegate
Are there any known conditions under which an NSTabView won't call its delegate methods? I can confirm in awakeFromNib the tab view's delegate is properly set to self (as per the outlet set in Interface Builder). Yet, none of the tab view delegate methods are ever being called in my class. - (void)awakeFromNib { NSLog (@awoke from nib. tab view delegate=%p, self=%p, [tabView delegate], self); } - (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem { NSLog (@didSelectTabViewItem); [selectedTabLabel setStringValue:[tabViewItem label]]; } - (BOOL)tabView:(NSTabView *)tabView shouldSelectTabViewItem:(NSTabViewItem *)tabViewItem { NSLog (@shouldSelectTabViewItem); return YES; } - (void)tabView:(NSTabView *)tabView willSelectTabViewItem:(NSTabViewItem *)tabViewItem { NSLog (@willSelectTabViewItem); } - (void)tabViewDidChangeNumberOfTabViewItems:(NSTabView *)tabView { NSLog (@tabViewDidChangeNumberOfTabViewItems); } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CALayer resizing puzzle
look at the ScrollViewSuite example.. specifically the tiling one. techniques illustrated. On Jan 21, 2010, at 12:39 PM, vincent habchi wrote: Hi to all, I'm trying to write a (at that time) simple GIS-like application based on Cocoa. For each cartographic layer, I use a CALayer object, which is nice to control things like opacity in real-time. However, I'm facing a challenge: when the user move the mouse, the drawing must move accordingly, feeling in white spaces that appear when updating the position property. However, to feel in those spaces, the app must be able to draw on it, thus the layer shall be resizable in every four direction, including left and below, while maintaining the existing drawing unchanged. I've tried to move the anchor point around and modify bounds or frame, but to no avail: or I get no extension, or I have a transitory motion corresponding to a bound property change (is there a way to disable the implied CASimpleAnimation?). So, put briefly, is there a way to extend a CALayer in whatever direction while keeping its content unmoving? Thanks! Vincent___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/scott%40cocoadoc.com This email sent to sc...@cocoadoc.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: NSTabViewDelegate
are you telling it to load the table using reload? On Jan 21, 2010, at 7:18 PM, Paul Forgey wrote: Are there any known conditions under which an NSTabView won't call its delegate methods? I can confirm in awakeFromNib the tab view's delegate is properly set to self (as per the outlet set in Interface Builder). Yet, none of the tab view delegate methods are ever being called in my class. - (void)awakeFromNib { NSLog (@awoke from nib. tab view delegate=%p, self=%p, [tabView delegate], self); } - (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem { NSLog (@didSelectTabViewItem); [selectedTabLabel setStringValue:[tabViewItem label]]; } - (BOOL)tabView:(NSTabView *)tabView shouldSelectTabViewItem:(NSTabViewItem *)tabViewItem { NSLog (@shouldSelectTabViewItem); return YES; } - (void)tabView:(NSTabView *)tabView willSelectTabViewItem:(NSTabViewItem *)tabViewItem { NSLog (@willSelectTabViewItem); } - (void)tabViewDidChangeNumberOfTabViewItems:(NSTabView *)tabView { NSLog (@tabViewDidChangeNumberOfTabViewItems); } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/scott%40cocoadoc.com This email sent to sc...@cocoadoc.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: NSRulerView and inches
On 22/01/2010, at 2:13 PM, Kyle Sluder wrote: But that's different from blithely drawing the resize handles at whatever scale AppKit has calculated for you. I didn't say I was. AppKit doesn't decide on the scale, the user does. Appkit merely sets up a transform to suit. The resize handles are carefully drawn in accordance with the scale according to the rules I want to apply - in my case at 33% of the zoom scale, within certain limits. It would also be possible to draw them always at the same scale (1:1) or at one of several fixed sizes if I wanted. At no point is anything not under the control of the programmer. My preferred solution: ditch NSRulerView. :) That does seem to me to be throwing the baby out with the bathwater. I guess if I wanted to heavily customise NSRulerView it might be easier to start from scratch, but the built-in class is not bad as far as it goes, and does do a great deal of really tedious work for you. So, what it boils down to is: a) roll your own view scaling/zooming and you have to implement your own rulers, or: b) use the built-in view scaling/zooming and you have to implement your own resize handles or other scale-proof UI widget drawing. Seems as broad as it's long to me, though I still favour (b)! --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSTabViewDelegate
On 22/01/2010, at 2:39 PM, Scott Anguish wrote: are you telling it to load the table using reload? I think this a tab view, not a table view. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Validating NSXMLDocument against external DTD
This does indeed do the trick, what I had not done was setName on the NSXMLDTD. Which, interestingly, has the effect of replacing the name of the doc type with the full text of the dtd. In the case of a Final Cut Pro XML that would turn this: !DOCTYPE xmeml into !DOCTYPE [full text of dtd here]. This example would assume that you did [myNSXMLDTD setName:@xmeml]. That strikes me as not entirely external anymore, since it will now show up in string representations of the XML. But it works. Afterwards the dtd can be taken out of the xml document's text by saying to the NSXMLDocument setDTD:nil. Thanks everyone for your help, Rainer On Jan 20, 2010, at 15:39 , Matt Neuburg wrote: The DTD can be external, but you have to call setName: on it so that it is coordinated with the root of your XML document. For example, suppose your xml goes like this (ripped off the Internet, silly example): ?xml version=1.0? note toTove/to fromJani/from headingReminder/heading bodyDon't forget me this weekend!/body /note And the dtd goes like this: !ELEMENT note (to, from, heading, body) !ELEMENT to (#PCDATA) !ELEMENT from (#PCDATA) !ELEMENT heading (#PCDATA) !ELEMENT body (#PCDATA) Then this works: NSURL* xmlurl = [[NSBundle mainBundle] URLForResource:@xml withExtension:@xml]; NSXMLDocument* doc = [[NSXMLDocument alloc] initWithContentsOfURL:xmlurl options:0 error:nil]; NSURL* dtdurl = [[NSBundle mainBundle] URLForResource:@dtd withExtension:@dtd]; NSXMLDTD* dtd = [[NSXMLDTD alloc] initWithContentsOfURL:dtdurl options:0 error:nil]; [dtd setName:@note]; [doc setDTD:dtd]; BOOL valid = [doc validateAndReturnError:nil]; if (valid) NSLog(@valid); // valid This point was well covered in a previous thread: http://lists.apple.com/archives/cocoa-dev/2006/Sep/msg00464.html m. Date: Tue, 19 Jan 2010 20:02:23 -0800 From: Rainer Standke li...@standke.com Subject: Validating NSXMLDocument against external DTD Hello, I am trying to validate an NSXMLDocument against an external DTD. Here is what I do: NSError *error = nil; NSXMLDocument *doc = [[[NSXMLDocument alloc] initWithXMLString:beamedXML options:NSXMLNodeOptionsNone error:error] autorelease]; if (!doc) { NSLog(@error: %@, error); } NSXMLElement *root = [doc rootElement]; //NSLog(@%@, [root description]); //NSBundle *theBundle = [NSBundle mainBundle]; //NSLog(@%@, [theBundle description]); NSString *dtdPath = [[NSBundle mainBundle] pathForResource:@FCPXMLv5 ofType:@dtd]; NSLog(@dtdPath: %@, dtdPath); NSURL *dtdUrl = [NSURL fileURLWithPath:dtdPath isDirectory:NO]; error = nil; NSXMLDTD *theDtd = [[[NSXMLDTD alloc] initWithContentsOfURL:dtdUrl options:NSXMLNodePreserveWhitespace error:error] autorelease]; if (!theDtd) { NSLog(@error: %@, error); } //NSLog(@theDtd: %@, theDtd); [doc setDTD:theDtd]; error = nil; if (! [doc validateAndReturnError:error]) { NSLog(@error: %@, error); } And this is what I get: Error Domain=NSXMLParserErrorDomain Code=1 UserInfo=0xdc17a50 no DTD found! It seems to me that the DTD is expected to be found inside the XML document. (The DTD seems to be created alright, since I can log it's description.) In this case that not what I need or want. The Tree- Based XML Programming Guide for Cocoa talks about external DTDs but I can't find a clue as how to do this. Is it even possible? -- matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/ pantes anthropoi tou eidenai oregontai phusei Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf AppleScript: the Definitive Guide, 2nd edition http://www.tidbits.com/matt/default.html#applescriptthings Take Control of Exploring Customizing Snow Leopard http://tinyurl.com/kufyy8 RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html TidBITS, Mac news and reviews since 1990, http://www.tidbits.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/lists%40standke.com This email sent to li...@standke.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: Uploading image via HTTP POST
I did try your suggestions with the different types of encoding but the resulting string still returned nil. You're right about the Tumblr post method. I looked at the Tumblr API again and they do have a form upload method that I implemented instead of what I was trying and it worked well. Thanks for your help--- I really appreciate it! Daniel On Jan 22, 2010, at 6:32 AM, Jens Alfke wrote: On Jan 21, 2010, at 8:39 AM, Daniel Meachum wrote: [[NSString alloc] initWithData:imageData encoding:NSUTF8StringEncoding]]; That's not going to work. Not all series of bytes are valid UTF-8, and in non-textual data like an image you're practically guaranteed to run into illegal UTF-8 sequences pretty quickly. The result will be a nil NSString. If you want a string encoding that supports arbitrary byte values, try NSWindowsCP1252StringEncoding, which is the default encoding used on Windows. (It's a superset of ISO-8859 that includes encodings for 80-9F.) You also haven't done any URL-encoding of the resulting string. Call stringByAddingPercentEscapesUsingEncoding: on the resulting string, but use NSWindowsCP1252StringEncoding as the encoding parameter (or whatever other 8-bit encoding you used.) —Jens PS: Off-topic, I can't believe the Tumblr engineers invented a protocol that's going to almost triple the size of the image data. It's not REST, or even the normal way that HTTP forms upload file attachments. Sigh. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSTabViewDelegate
I relooked at the doc, and I don’t see anything here trying to make up for my stupidity. can you post the creation code? Not helpful, but I don’t think you need to implement any of these.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSTabViewDelegate
On Jan 21, 2010, at 10:46 PM, Graham Cox wrote: On 22/01/2010, at 2:39 PM, Scott Anguish wrote: are you telling it to load the table using reload? I think this a tab view, not a table view. Oh, for crying out loud. I’m an absolute idiot. Thanks for pointing that out Graham.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CALayer resizing puzzle
this specific example of course assumes that you’re using the iphone. But, the technique should be sound for what you’re trying to do. The technique is applicable to use a pool of multiple views to contain smaller amounts of the content. the advantage is that you can render or fetch the content that is visible (or could be next) only when required. As you show new content relocate the views, create the layers (which you could do in the reusable pool) and the set the content. Then move the no longer visible layers back to the pool, clearing the content to save space. On Jan 21, 2010, at 10:38 PM, Scott Anguish wrote: look at the ScrollViewSuite example.. specifically the tiling one. techniques illustrated. On Jan 21, 2010, at 12:39 PM, vincent habchi wrote: Hi to all, I'm trying to write a (at that time) simple GIS-like application based on Cocoa. For each cartographic layer, I use a CALayer object, which is nice to control things like opacity in real-time. However, I'm facing a challenge: when the user move the mouse, the drawing must move accordingly, feeling in white spaces that appear when updating the position property. However, to feel in those spaces, the app must be able to draw on it, thus the layer shall be resizable in every four direction, including left and below, while maintaining the existing drawing unchanged. I've tried to move the anchor point around and modify bounds or frame, but to no avail: or I get no extension, or I have a transitory motion corresponding to a bound property change (is there a way to disable the implied CASimpleAnimation?). So, put briefly, is there a way to extend a CALayer in whatever direction while keeping its content unmoving? Thanks! Vincent___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/scott%40cocoadoc.com This email sent to sc...@cocoadoc.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/scott%40cocoadoc.com This email sent to sc...@cocoadoc.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