Re: inter-object communication
- Original Message From: Albert Jordan [EMAIL PROTECTED] What is the recommended way for Object B to inform Object A that it is done processing a request for the following scenario? Object A has a list of phone numbers to send SMS messages Object B implements sending an SMS message to a given phone number I think a delegate is the usual Cocoa pattern for this kind of situation. You could have Object B send Object A an -objectB:didSendSMSMessage:toNumber: message or something along those lines. Cheers, Chuck ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
NSTableColumn unbindable when NSSegmentedCell is used?
Hello, I'm migrating a non-binding version of an NSTableView over to a binded version. In the non-binding version (using a data source), one of my table columns used a subclass of NSSegmentedCell, and I merely overrode setObjectValue in order to capture the data and set the number of segments, their labels, etc. In the binded version, I have successfully converted all of the text field cells - each NSTableColumn has a 'value' binding, which I set to [controller.arrangedObjects.key], and I'm able to see all of my text data just fine. However, the NSTableColumn containing my NSSegmentedCell subclass mysteriously lacks a 'value' binding, and I'm unable to fathom how to set the data inside of it. Can anyone point me to the correct way to bind my arrangedObjects to those NSSegmentedCells? Thanks very much! Regards, Mike Laurence ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
How to show Interface Builder's build warning and messages?
Recently I was building my project and saw there were some warnings and messages regarding a XIB file. For example, there were warnings that some connection outlets were broken, and there were messages that some views were clipping their own content. After I fixed the connection outlets, the warnings were gone, but the messages were no longer displayed neither, yet I still wanted to fix the clipping views too. In other words, if there are no warnings but only messages in a XIB, the latter are not shown in the build results. How do I re-show these messages again in IB? I tried to click Info for the XIB in IB, but the list is empty. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
file references in CoreData
hello, I’m very new to CoreData and can’t find anything on this: I need to store references to local files in CoreData. What is the best solution for this. Just now I use plain paths but there has to be a better way. Thanks Georg___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: filtering a tableView from a pulldown
On 28 Oct 2008, at 16:15, I. Savant wrote: The pulldown is bound as follows: content: arrangedObjects[PurchaseOrder Array Controller(NSArray Controller)] content values: Purchase ORder Array Controller arrangedObjects.orderReference These bindings seem fine. How about selection? One of the popup's selection bindings should be bound to the PurchaseOrder Array Controller's selection. The pop up has selectedObject bound to Purchase Order Array Controller 2 selection.orderReference All of this is on a panel that appears when I select a Purchase Order and click a Details button. The popup correctly shows the selected Purchase Order Order Reference, and lists all of the other Purchase orders within it. The Table view has 6 columns, one of which is the Purchase Order number (as displayed in the pulldown) This seems wrong. If your table is intended to display the line items belonging to the order, why have the order number on each line item? I don't really need it, I created most of the interface by alt- dragging from the data model, and it put it there, at the moment it's handy for me to quickly see that it's not working properly, as when it is working, all the lines should have the same value there. It's not vital for it to be there though, In any case, you need a *separate* controller to reflect the line items of the selected order. Create an array controller and set it up so that it holds your line item objects. We'll call it your Line Item Array Controller. OK, I have an Array Controller for that, called Purchase Order Items Array Controller. Its contents should be bound to PurchaseOrder Array Controller's selection.lineItems (or whatever the key path is to your order's line items). At the moment the content Object is bound to selection.orderReference of the Purchase Order Array Controller. I tried to bind the contentArray to that but it threw an error, Your table view's columns should each be bound to the Line Item Array Controller's arrangedObjects.property (where property refers to individual properties such as item number, description, quantity, etc.). My Qty table column is bound to Purchase Order Items Array Controller arrangedObjects.qty Then I have other columns: Vendor SKU - Purchase Order Items Array Controller arrangedObjects.vendorSKU Product - content- Products Array Controller arrangedObjects contentValues-Products Array Controller arrangedObjects.sku selectedObject-Purchase Order Items Array Controller arrangedObjects.product Purchase Order (not vital) - content- Purchase Order Array Controller arrangedObjects contentValues- Purchase Order Array Controller arrangedObjects.orderReference selectedObject- Purchase Order Items Array Controller arrangedObjects.purchaseOrder Shipment content- Shipment Array Controller arrangedObjects contentValues- Shipment Array Controller arrangedObjects.shipperReference selectedObject- Purchase Order Items Array Controller arrangedObjects.shipment but the panel won't load and displays the following error: [Session started at 2008-10-29 08:42:05 +.] 2008-10-29 08:42:07.826 powizard[6592] *** NSRunLoop ignoring exception '[NSCFString 0x164c740 valueForUndefinedKey:]: this class is not key value coding-compliant for the key qty.' that raised during posting of delayed perform with target 16699b0 and selector 'invokeWithTarget:' 2008-10-29 08:42:07.829 powizard[6592] *** NSRunLoop ignoring exception '[NSCFString 0x164c740 valueForUndefinedKey:]: this class is not key value coding-compliant for the key shipment.' that raised during posting of delayed perform with target 1669b50 and selector 'invokeWithTarget:' Spend as much time as you can manage reading over the documentation I sent you previously. If there are things you don't understand, post your questions back to the list for clarification. I have read through it, and it's not as much that it doesn't make sense, I can see what it's saying, it's applying it that I'm struggling with, and I've got both the 2nd and 3rd editions of cocoa programming, but the second edition doesnt cover core data as much, and the third edition uses leopard, where I am on 10.4, and wanting to release for 10.4 too and the IB interface/panels etc are quite different, -- I.S. Thank you for all 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 [EMAIL PROTECTED]
Re: file references in CoreData
Hi, When using Leopard this is easy: you can store any data type in core data using the 'Transformable' type. Use this to store instances of NSURL that point to your files see http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdNSAttributes.html for more information. Dirkjan On Oct 29, 2008, at 9:44 , Georg Seifert wrote: hello, I’m very new to CoreData and can’t find anything on this: I need to store references to local files in CoreData. What is the best solution for this. Just now I use plain paths but there has to be a better way. Thanks Georg___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/dirkjan%40krijnders.net This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Path handling routines
Hello, Are there in the Foundation framework (or anywhere else on the Cocoa platform) path handling routines (directory extraction, path decomposition) ? Cheers ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: ASL Unicode in Xcode's Console
Hi, A solution for this is to not use directly asl_log, but wrap it to a function that will then use asl_log for console, and fprintf for logging to stderr (instead of asl_open(stderr)), of course you will have to regenerate yourself date, host name, process name, process id information if needed when using fprintf. Regards, Yvan Le 28 oct. 08 à 19:01, Karl Moskowski a écrit : I've been experimenting with replacing my app's logging with Apple System Logger. When it comes to multi-byte characters, every thing looks OK in Console.app. However, Xcode's console shows things incorrectly. It probably won't come up often, but I'm wondering if it's fixable. For example, this bit of code: NSLog(@あ); aslclient client = asl_open(NULL, NULL, ASL_OPT_STDERR); // add STDERR's fd to the connection's set of fds so things show up in Xcode's console asl_log(client, NULL, ASL_LEVEL_ERR, あ); asl_close(client); Results in this output in Xcode: 2008-10-28 13:49:19.767 ASL[3484:10b] あ Tue Oct 28 13:49:19 iMac.local ASL[3484] Error: \M-c\M^A\M^B The call to NSLog displays correctly, but asl_log doesn't. (In case it doesn't survive email, the character in quotes is Hiragana Letter A, from Leopard's Character Palette East Asian Scripts Hiragana first character.) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Path handling routines
On Oct 29, 2008, at 9:01 AM, Daniel Luis dos Santos wrote: Hello, Are there in the Foundation framework (or anywhere else on the Cocoa platform) path handling routines (directory extraction, path decomposition) ? Cheers There are a group of methods in NSString for working with paths. http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html And scroll down to Working with Paths ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Path handling routines
NSString has most of them. See -[NSString pathComponents], -[NSString stringByAppendingPathComponent:] etc. On Wed, Oct 29, 2008 at 1:01 PM, Daniel Luis dos Santos [EMAIL PROTECTED] wrote: Hello, Are there in the Foundation framework (or anywhere else on the Cocoa platform) path handling routines (directory extraction, path decomposition) ? Cheers ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/maillist%40steelskies.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Open Window from Input Manager
Hi, thank you for your reply. Does this mean that I'm trying to loading a NIB file from the bundle of the running application (in which the input manager has been loaded)? NSBundle *bundle = [NSBundle bundleWithIdentifier: @org.x616c.LMC]; I've found out how to find the right bundle, but I'm still stuck in trying to load a window from a NIB file inside my bundle ... can someone help me? Best regards, Daniel On Wed, Oct 29, 2008 at 4:49 AM, [EMAIL PROTECTED] wrote: Hi, I'm working on a project for inserting special characters in text fields in all Cocoa apps by means of an Input Manager. After a given trigger/shortcut I have the need to open a window/panel, but I don't get it. I've tried to load a NIB file, but the Console reported -[NSWindowController loadWindow]: failed to load window nib file 'Chooser' Is there another way to do it right? I've basically the need to open a panel/window, change the keyboard focus from the textfield to the opened panel and then continue by closing the panel. Hard to say if there's another way to do it when we don't know how you're doing it now. At a guess, you're telling Cocoa to look for Chooser in the main bundle, but you are not the main bundle so this is the wrong place to look. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: ASL Unicode in Xcode's Console
On Oct 29, 2008, at 09:06 , Yvan BARTHÉLEMY wrote: A solution for this is to not use directly asl_log, but wrap it to a function that will then use asl_log for console, and fprintf for logging to stderr (instead of asl_open(stderr)), of course you will have to regenerate yourself date, host name, process name, process id information if needed when using fprintf. Yeah, that's basically the solution I used, but didn't really bother with re-generating the log information. I also used an undocumented call that I found on the asl source code that let me specify the encoding that I wanted instead of defaulting to that stupid visual encoding for the console. But I wrapped the ASL stuff in an Objective- C class so I just added code that if the level was ASL_LEVEL_DEBUG and NDEBUG wasn't defined, the data went to stderr as well as the logging system. J smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: ASL Unicode in Xcode's Console
On 10/29/08 1:27 AM, Jason Coco said: That is no longer necessary in 10.5 / Xcode 3. You can use Unicode in string literals in Objective-C. Why do you say this? I thought that I may have missed something, but looking back through all the documentation, all the warnings about only including 7-bit ASCII characters in string literals still exist... even in the most recent updated documentation. ISTR seeing this in the release notes somewhere, but can't find it now either. Anyway, see http://lists.apple.com/archives/Cocoa-dev/2008/Apr/msg01885.html Well, I still can't find anything that says this other than somebody's statement on a mailing list... Aki's not just a 'somebody' but a member of Apple's Cocoa team. There are several posts in the archives about this being supported now. IIRC, it only works in .m/.mm files, not .c/.cpp. the three most recently updated documents that apple put out dealing with strings all specifically say that string literals (CFStringRef, NSConstantString and c style string constants) all must be 7-bit ascii encoded Please file a bug against the docs. -- Sean McBride, B. Eng [EMAIL PROTECTED] 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 [EMAIL PROTECTED]
Re: Open Window from Input Manager
Is your spelling right? The method is loadNibNamed:owner:; your email says loadNibName:owner:. AppKit should be included in your average cocoa program. Also note that it's a class method, not an instance method. Not sure what else would be causing it. -- Kevin Kevin Gessner http://www.kevingessner.com [EMAIL PROTECTED] On Oct 29, 2008, at 10:25 AM, Daniel wrote: Hi Kevin, this seems to be right method, but I don't know how to use the NSBundle with the AppKit additions ... and therefore I get the selector not recognized error while using the loadNibName:owner: method. Best regards and thanks, Daniel On Wed, Oct 29, 2008 at 3:06 PM, Kevin Gessner [EMAIL PROTECTED] wrote: Would loadNibNamed:owner: in the NSBundle Additions work? http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSBundle_AppKitAdditions/Reference/Reference.html#/ /apple_ref/doc/uid/2401-CJBHHDFC Pass in an object in your bundle as owner, and it should look in your bundle for the window. Then you can treat the window (and other NIB objects) as any other, through outlets. HTH, -- Kevin Kevin Gessner http://www.kevingessner.com [EMAIL PROTECTED] On Oct 29, 2008, at 9:29 AM, Daniel wrote: Hi, thank you for your reply. Does this mean that I'm trying to loading a NIB file from the bundle of the running application (in which the input manager has been loaded)? NSBundle *bundle = [NSBundle bundleWithIdentifier: @org.x616c.LMC]; I've found out how to find the right bundle, but I'm still stuck in trying to load a window from a NIB file inside my bundle ... can someone help me? Best regards, Daniel On Wed, Oct 29, 2008 at 4:49 AM, cocoa-dev- [EMAIL PROTECTED] wrote: Hi, I'm working on a project for inserting special characters in text fields in all Cocoa apps by means of an Input Manager. After a given trigger/shortcut I have the need to open a window/ panel, but I don't get it. I've tried to load a NIB file, but the Console reported -[NSWindowController loadWindow]: failed to load window nib file 'Chooser' Is there another way to do it right? I've basically the need to open a panel/window, change the keyboard focus from the textfield to the opened panel and then continue by closing the panel. Hard to say if there's another way to do it when we don't know how you're doing it now. At a guess, you're telling Cocoa to look for Chooser in the main bundle, but you are not the main bundle so this is the wrong place to look. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/kevin%40kevingessner.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: ASL Unicode in Xcode's Console
In fact I am very interested about this undocumented call as it is painful for me to dig into darwin sources. Thanks, Yvan Le 29 oct. 08 à 14:41, Jason Coco a écrit : On Oct 29, 2008, at 09:06 , Yvan BARTHÉLEMY wrote: A solution for this is to not use directly asl_log, but wrap it to a function that will then use asl_log for console, and fprintf for logging to stderr (instead of asl_open(stderr)), of course you will have to regenerate yourself date, host name, process name, process id information if needed when using fprintf. Yeah, that's basically the solution I used, but didn't really bother with re-generating the log information. I also used an undocumented call that I found on the asl source code that let me specify the encoding that I wanted instead of defaulting to that stupid visual encoding for the console. But I wrapped the ASL stuff in an Objective-C class so I just added code that if the level was ASL_LEVEL_DEBUG and NDEBUG wasn't defined, the data went to stderr as well as the logging system. J ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Open Window from Input Manager
On Wed, Oct 29, 2008 at 9:29 AM, Daniel [EMAIL PROTECTED] wrote: Hi, thank you for your reply. Does this mean that I'm trying to loading a NIB file from the bundle of the running application (in which the input manager has been loaded)? NSBundle *bundle = [NSBundle bundleWithIdentifier: @org.x616c.LMC]; I've found out how to find the right bundle, but I'm still stuck in trying to load a window from a NIB file inside my bundle ... can someone help me? Your last post indicated an NSWindowController being used to load the nib. I am not 100% sure on this (please post your code when you have question!) but that's how it appeared. If so, then you should be able to get things working by using a custom subclass of NSWindowController that's in your bundle. NSWindowController is, I think, smart enough to look in the same bundle as the class of the object doing the loading. Failing that, rather than using -initWithWindowNibName:, use -initWithWindowNibPath:owner: which allows you to specify a full path. NSBundle can get you a full path for any resource file. If you want to load the nib manually (not recommended, always use NSWindowController or NSViewController to load nibs) then you can use the NSNib class, or one of the NSBundle extensions in NSNibLoading.h. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: ASL Unicode in Xcode's Console
On Oct 29, 2008, at 09:41 , Jason Coco wrote: On Oct 29, 2008, at 09:06 , Yvan BARTHÉLEMY wrote: A solution for this is to not use directly asl_log, but wrap it to a function that will then use asl_log for console, and fprintf for logging to stderr (instead of asl_open(stderr)), of course you will have to regenerate yourself date, host name, process name, process id information if needed when using fprintf. Yeah, that's basically the solution I used, but didn't really bother with re-generating the log information. I also used an undocumented call that I found on the asl source code that let me specify the encoding that I wanted instead of defaulting to that stupid visual encoding for the console. But I wrapped the ASL stuff in an Objective- C class so I just added code that if the level was ASL_LEVEL_DEBUG and NDEBUG wasn't defined, the data went to stderr as well as the logging system. I too put the logging in a wrapper class, with a method that does the heavy lifting and a few macros that simplify its use. Now, instead using ASL_OPT_STDERR, I just fprintf nicely formatted messages to stderr. To make sure that there's no duplication of messages in the Console, I wrapped the fprintf section in a conditional to ensure it's a tty. Now, when Xcode runs the app, logging is echoed to Xcode's console. It also has the advantage that Debug-level messages show up in the console, but syslog's filters prevent them from making it to the system log. (I got the idea from http://www.cocoabuilder.com/archive/message/cocoa/2008/2/11/198548 .) // ASLogger.h #define ASLog(c, s, l,...) [ASLogger logTo:(c) level:l sourceFile:__FILE__ lineNumber:__LINE__ format:(s), ##__VA_ARGS__] #define ASLogError(c, s, ...) ASLog((c), (s), ASL_LEVEL_ERR, ##__VA_ARGS__) #define ASLogNotice(c, s, ...) ASLog((c), (s), ASL_LEVEL_NOTICE, ##__VA_ARGS__) #define ASLogDebug(c, s, ...) ASLog((c), (s), ASL_LEVEL_DEBUG, ##__VA_ARGS__) // ASLogger.m + (void) logTo:(aslclient)client level:(NSInteger)level sourceFile: (char *)sourceFile lineNumber:(NSUInteger)lineNumber format:(NSString *)format, ... { va_list ap; va_start(ap,format); NSMutableString *message = [[NSMutableString alloc] initWithFormat:format arguments:ap]; va_end(ap); [message appendFormat:@ [%u], lineNumber]; asl_log(client, NULL, level, [message UTF8String]); if (isatty(fileno(stderr))) { NSString *now = [[NSCalendarDate calendarDate] descriptionWithCalendarFormat:@%a %b %d %H:%M:%S]; fprintf(stderr, %s %s:%u %s %s\r\n, [now UTF8String], [[[NSString stringWithUTF8String:sourceFile] lastPathComponent] UTF8String], lineNumber, [self aslLevelToString:level], [message UTF8String]); fflush(stderr); } } + (const char *)aslLevelToString:(int) level { switch (level) { case ASL_LEVEL_EMERG: return ASL_STRING_EMERG; case ASL_LEVEL_ALERT: return ASL_STRING_ALERT; case ASL_LEVEL_CRIT:return ASL_STRING_CRIT; case ASL_LEVEL_ERR: return ASL_STRING_ERR; case ASL_LEVEL_WARNING: return ASL_STRING_WARNING; case ASL_LEVEL_NOTICE: return ASL_STRING_NOTICE; case ASL_LEVEL_INFO:return ASL_STRING_INFO; default:return ASL_STRING_DEBUG; } } Karl Moskowski [EMAIL PROTECTED] Voodoo Ergonomics Inc. http://voodooergonomics.com/ smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Open Window from Input Manager
I finally got it! :-) snippet NSBundle *bundle = [NSBundle bundleWithIdentifier: @org.x616c.LMC]; NSWindowController *controller = [[NSWindowController alloc] initWithWindowNibPath: [NSString stringWithFormat:@%@/Contents/Resources/Chooser.nib, [bundle bundlePath]] owner: self]; [controller showWindow:self]; /snippet thank all for the help! Daniel On Wed, Oct 29, 2008 at 4:25 PM, Michael Ash [EMAIL PROTECTED] wrote: On Wed, Oct 29, 2008 at 9:29 AM, Daniel [EMAIL PROTECTED] wrote: Hi, thank you for your reply. Does this mean that I'm trying to loading a NIB file from the bundle of the running application (in which the input manager has been loaded)? NSBundle *bundle = [NSBundle bundleWithIdentifier: @org.x616c.LMC]; I've found out how to find the right bundle, but I'm still stuck in trying to load a window from a NIB file inside my bundle ... can someone help me? Your last post indicated an NSWindowController being used to load the nib. I am not 100% sure on this (please post your code when you have question!) but that's how it appeared. If so, then you should be able to get things working by using a custom subclass of NSWindowController that's in your bundle. NSWindowController is, I think, smart enough to look in the same bundle as the class of the object doing the loading. Failing that, rather than using -initWithWindowNibName:, use -initWithWindowNibPath:owner: which allows you to specify a full path. NSBundle can get you a full path for any resource file. If you want to load the nib manually (not recommended, always use NSWindowController or NSViewController to load nibs) then you can use the NSNib class, or one of the NSBundle extensions in NSNibLoading.h. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/daniel.rampanelli%40gmail.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Open Window from Input Manager
On Oct 29, 2008, at 9:16 AM, Daniel wrote: [NSString stringWithFormat:@%@/Contents/Resources/Chooser.nib, [bundle bundlePath]] I'm afraid I missed the start of this discussion, but this snippet is wrong. It should be [bundle pathForResource:@Chooser ofType:@nib]. Douglas Davidson ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
How do I call a function when my preference pane bundle closes?
Hi there, I want to save preferences when the user either closes the preference pane window, clicks the show all button or quits system preferences. Can I just put the method call in the -(void)dealloc or is this a bad idea? Thanks, Adam ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Path handling routines
On Oct 29, 2008, at 6:01 AM, Daniel Luis dos Santos wrote: Hello, Are there in the Foundation framework (or anywhere else on the Cocoa platform) path handling routines (directory extraction, path decomposition) ? NSString has several methods for extracting the basename, directory name, extension etc. • + pathWithComponents: • – pathComponents • – completePathIntoString:caseSensitive:matchesIntoArray:filterTypes: • – fileSystemRepresentation • – getFileSystemRepresentation:maxLength: • – isAbsolutePath • – lastPathComponent • – pathExtension • – stringByAbbreviatingWithTildeInPath • – stringByAppendingPathComponent: • – stringByAppendingPathExtension: • – stringByDeletingLastPathComponent • – stringByDeletingPathExtension • – stringByExpandingTildeInPath • – stringByResolvingSymlinksInPath • – stringByStandardizingPath • – stringsByAppendingPaths: The safest way of turning argv[i] into an NSString is with NSFileManager, thus: NSString *path = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:argv[i] length:strlen(argv[i])]; ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Path handling routines
On Oct 29, 2008, at 9:24 AM, Jamie Hardt wrote: The safest way of turning argv[i] into an NSString is with NSFileManager, thus: NSString *path = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:argv[i] length:strlen(argv[i])]; The best way to turn an arbitrary C string path into an NSString is via NSFileManager, but for arguments specifically one can use NSProcessInfo to obtain them as an array of NSStrings directly. Douglas Davidson ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How do I call a function when my preference pane bundle closes?
On Oct 29, 2008, at 12:22 , Adam Penny wrote: Hi there, I want to save preferences when the user either closes the preference pane window, clicks the show all button or quits system preferences. Can I just put the method call in the -(void)dealloc or is this a bad idea? This is a bad idea. -(void)dealloc may never be called. You should do this in your pref pane subclass in the -(void)didUnselect or - (void)willUnselect functions. J smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How do I call a function when my preference pane bundle closes?
Thank you Jamie and Jason. Jamie's email has just panicked me as I've been using CFPreferences rather than NSUserDefaults. It's a system preference pane and I understood that CFPreferences was the way to do this. The documents for CFPreferences kept on saying not to synchronize regularly, so I thought that when synching when the window closed would be a good option. That said, if I'm on the wrong track I can always change my strategy if there's a better way I missed? Adam On Oct29, 2008, at 5:38 PM, Jason Coco wrote: On Oct 29, 2008, at 12:22 , Adam Penny wrote: Hi there, I want to save preferences when the user either closes the preference pane window, clicks the show all button or quits system preferences. Can I just put the method call in the -(void)dealloc or is this a bad idea? This is a bad idea. -(void)dealloc may never be called. You should do this in your pref pane subclass in the -(void)didUnselect or - (void)willUnselect functions. J ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How do I call a function when my preference pane bundle closes?
On Oct 29, 2008, at 10:22 AM, Adam Penny wrote: I want to save preferences when the user either closes the preference pane window, clicks the show all button or quits system preferences. Can I just put the method call in the -(void)dealloc or is this a bad idea? Bad idea. -dealloc is reserved for nullifying pointers in other objects, releasing objects, etc. Your idea will also break if the pane never gets deallocated, and will also fail if preference panes ever support GC in the future. I would recommend just setting preferences as you go; this is not an expensive thing to do. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How to show Interface Builder's build warning and messages?
On 10/29/08 9:39 AM, Oleg Krupnov said: Recently I was building my project and saw there were some warnings and messages regarding a XIB file. For example, there were warnings that some connection outlets were broken, and there were messages that some views were clipping their own content. After I fixed the connection outlets, the warnings were gone, but the messages were no longer displayed neither, yet I still wanted to fix the clipping views too. In other words, if there are no warnings but only messages in a XIB, the latter are not shown in the build results. How do I re-show these messages again in IB? I tried to click Info for the XIB in IB, but the list is empty. This would be better on the Xcode list, but... Have you looked at IB's Preferences Alerts? -- Sean McBride, B. Eng [EMAIL PROTECTED] 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 [EMAIL PROTECTED]
Re: file references in CoreData
On 10/29/08 7:02 AM, I. Savant said: I need to store references to local files in CoreData. What is the best solution for this. Just now I use plain paths but there has to be a better way. I use the much-lauded BDAlias: http://eschatologist.net/bDistributed.com/index.html Another option is NDAlias: http://homepage.mac.com/nathan_day/pages/source.xml Last I checked, BDAlias does not support garbage collection and 64bit, which NDAlias does. -- Sean McBride, B. Eng [EMAIL PROTECTED] 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 [EMAIL PROTECTED]
Re: ASL Unicode in Xcode's Console
Sean, Thanks for following up to my comment 8-). Yes, we do support non-ASCII characters in CFString/NSString literals with the compiler shipped with Xcode 3.0 and later. The compiler does recognize the CFSTR() macro in non-Objc source files and both the macro and @ notion in ObjC files. The documentation is not updated to reflect the new functionality, yet. Filing bugs would certainly help. Note I realized that some of you might have experienced issues embedding non-ASCII characters even with Xcode 3.x compilers earlier this year. The functionality was not enabled for some beta versions of a certain SDK we're not supposed to discuss here 9-) Aki the man behind NSString/CFString Unicode magic On 2008/10/29, at 7:16, Sean McBride wrote: On 10/29/08 1:27 AM, Jason Coco said: That is no longer necessary in 10.5 / Xcode 3. You can use Unicode in string literals in Objective-C. Why do you say this? I thought that I may have missed something, but looking back through all the documentation, all the warnings about only including 7-bit ASCII characters in string literals still exist... even in the most recent updated documentation. ISTR seeing this in the release notes somewhere, but can't find it now either. Anyway, see http://lists.apple.com/archives/Cocoa-dev/2008/Apr/msg01885.html Well, I still can't find anything that says this other than somebody's statement on a mailing list... Aki's not just a 'somebody' but a member of Apple's Cocoa team. There are several posts in the archives about this being supported now. IIRC, it only works in .m/.mm files, not .c/.cpp. the three most recently updated documents that apple put out dealing with strings all specifically say that string literals (CFStringRef, NSConstantString and c style string constants) all must be 7-bit ascii encoded Please file a bug against the docs. -- Sean McBride, B. Eng [EMAIL PROTECTED] 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/aki%40apple.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: file references in CoreData
On Wed, Oct 29, 2008 at 1:15 PM, Sean McBride [EMAIL PROTECTED] wrote: Last I checked, BDAlias does not support garbage collection and 64bit, which NDAlias does. Good catch. Looks like I might need to update my own code in the next few months. :-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Is there an equivalent to std::min/std::max for Cocoa programmer's
-Michael smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How do I call a function when my preference pane bundle closes?
On Oct 29, 2008, at 9:47 AM, Adam Penny wrote: Thank you Jamie and Jason. Jamie's email has just panicked me as I've been using CFPreferences rather than NSUserDefaults. It's a system preference pane and I understood that CFPreferences was the way to do this. The documents for CFPreferences kept on saying not to synchronize regularly, so I thought that when synching when the window closed would be a good option. That said, if I'm on the wrong track I can always change my strategy if there's a better way I missed? If you're doing a Cocoa application, NSUserDefaults and its friends are definitely the simpler way to go, but they both work. Jamie Hardt The Sound Department http://www.soundepartment.com/ http://www.imdb.com/name/nm0362504/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: file references in CoreData
I'm currently working on a system that uses NDAlias (http://codebeach.org/code/show/34 ) in a CoreData store. It works pretty well in that the user can move the files around when the app isn't running and (so long as they stay on the same volume) it'll find them again when it wakes up. I'm using mogenerator (http://rentzsch.com/code/mogenerator), so I set the attribute to the 'Transformable' and add to the user info (in the user tab of the model editor the key: 'attributeValueClassName' and value: 'NDAlias'. I also had to modify the standard template to #import NDAlias.h which is a little hacky - but I didn't have time to follow it up. If you do use NDAlias, keep in mind that the factory you will most likely use +[NDAlias aliasFromPath] only creates a minimal alias that doesn't follow moved files (and seems a little pointless to me!) so use one of the other methods (where you specify a relative path). pt. P.S. if you use mogenerator and find an elegant fix for the missing header problem, please submit a patch to the author so we can all benefit. On 29 Oct 2008, at 08:44, Georg Seifert wrote: hello, I’m very new to CoreData and can’t find anything on this: I need to store references to local files in CoreData. What is the best solution for this. Just now I use plain paths but there has to be a better way. Thanks Georg___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/pthomas%40spongelava.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: file references in CoreData
On 29.10.2008, at 09:59, Dirkjan Krijnders wrote: When using Leopard this is easy: you can store any data type in core data using the 'Transformable' type. Use this to store instances of NSURL that point to your files see http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdNSAttributes.html for more information. I'd recommend going for an Alias Record instead. URLs are just as fragile as file paths. NDAlias or BDAlias can be serialized to NSData. Keep the path as a backup, but really, recovering files across restarts and tracking them even if the user moves them or the drive gets mounted under a different mount point is a job for Aliases. Cheers, -- Uli Kusterer The Witnesses of TeachText are everywhere... http://www.zathras.de ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: file references in CoreData
On 10/29/08 11:05 AM, Paul Thomas said: I'm currently working on a system that uses NDAlias (http:// codebeach.org/code/show/34 ) in a CoreData store. It works pretty well in that the user can move the files around when the app isn't running and (so long as they stay on the same volume) it'll find them again when it wakes up. I'm using mogenerator (http://rentzsch.com/code/mogenerator), so I set the attribute to the 'Transformable' and add to the user info (in the user tab of the model editor the key: 'attributeValueClassName' and value: 'NDAlias'. I also had to modify the standard template to #import NDAlias.h which is a little hacky - but I didn't have time to follow it up. We do exactly the same. P.S. if you use mogenerator and find an elegant fix for the missing header problem, please submit a patch to the author so we can all benefit. We have submitted such a patch, but the author is busy of late, though I'm confident he'll eventually incorporate it. In the meantime, I suggest you import NDAlias.h into your prefix header, that way you don't need to edit the machine files. -- Sean McBride, B. Eng [EMAIL PROTECTED] 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 [EMAIL PROTECTED]
How to get CGScreenRegisterMoveCallback working?
Hi list, I am a complete Objective-C/Cocoa/Xcode novice, so please be gentle if my mistake is dead obvious. I am trying to detect whether any window moves on the screen. As far as I can tell CGScreenRegisterMoveCallback should let me do this. But in the little test code below, which registers callbacks then waits 20 seconds, I never see the message Updated or Refreshed. The code builds and runs without warnings. Any ideas? Many thanks, Steve McLeod --- #import Foundation/Foundation.h #import Cocoa/Cocoa.h void MyScreenRefreshCallback (CGRectCount count, const CGRect * rectArray, void * userParameter){ NSLog(@Refreshed); } void MyScreenUpdateMoveCallback (CGScreenUpdateMoveDelta delta, size_t count, const CGRect * rectArray, void * userParameter) { NSLog(@Updated); } int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSLog(@Started); CGRegisterScreenRefreshCallback(MyScreenRefreshCallback, NULL); CGScreenRegisterMoveCallback(MyScreenUpdateMoveCallback, NULL); sleep(20); [pool drain]; return 0; } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How to get CGScreenRegisterMoveCallback working?
On Oct 29, 2008, at 12:00 PM, Steve McLeod wrote: I am trying to detect whether any window moves on the screen. As far as I can tell CGScreenRegisterMoveCallback should let me do this. But in the little test code below, which registers callbacks then waits 20 seconds, I never see the message Updated or Refreshed. The code builds and runs without warnings. Any ideas? You need to create and run a run loop. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How to get CGScreenRegisterMoveCallback working?
Thanks Nick, I tried creating a RunLoop, that runs for 10 seconds, but I still had no joy. I guess I'm still making beginner mistakes. Any ideas from the code below, which now has a RunLoop? #import Foundation/Foundation.h #import Cocoa/Cocoa.h void MyScreenRefreshCallback (CGRectCount count, const CGRect * rectArray, void * userParameter){ NSLog(@Refreshed); } void MyScreenUpdateMoveCallback (CGScreenUpdateMoveDelta delta, size_t count, const CGRect * rectArray, void * userParameter) { NSLog(@Updated); } int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSLog(@Started); CGRegisterScreenRefreshCallback(MyScreenRefreshCallback, NULL); CGScreenRegisterMoveCallback(MyScreenUpdateMoveCallback, NULL); NSRunLoop *runLoop = [NSRunLoop currentRunLoop]; [runLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow: 10]]; NSLog(@Finished); [pool drain]; return 0; } 2008/10/29 Nick Zitzmann [EMAIL PROTECTED] On Oct 29, 2008, at 12:00 PM, Steve McLeod wrote: I am trying to detect whether any window moves on the screen. As far as I can tell CGScreenRegisterMoveCallback should let me do this. But in the little test code below, which registers callbacks then waits 20 seconds, I never see the message Updated or Refreshed. The code builds and runs without warnings. Any ideas? You need to create and run a run loop. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: ASL Unicode in Xcode's Console
When a method is undocumented, that means it isn't part of the interface that is stable from release to release. If that function is removed from the OS, and you reference it in your binary, your app will not launch. -Ken On Wed, Oct 29, 2008 at 7:53 AM, Yvan BARTHÉLEMY [EMAIL PROTECTED] wrote: In fact I am very interested about this undocumented call as it is painful for me to dig into darwin sources. Thanks, Yvan Le 29 oct. 08 à 14:41, Jason Coco a écrit : On Oct 29, 2008, at 09:06 , Yvan BARTHÉLEMY wrote: A solution for this is to not use directly asl_log, but wrap it to a function that will then use asl_log for console, and fprintf for logging to stderr (instead of asl_open(stderr)), of course you will have to regenerate yourself date, host name, process name, process id information if needed when using fprintf. Yeah, that's basically the solution I used, but didn't really bother with re-generating the log information. I also used an undocumented call that I found on the asl source code that let me specify the encoding that I wanted instead of defaulting to that stupid visual encoding for the console. But I wrapped the ASL stuff in an Objective-C class so I just added code that if the level was ASL_LEVEL_DEBUG and NDEBUG wasn't defined, the data went to stderr as well as the logging system. J ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How to get CGScreenRegisterMoveCallback working?
On Oct 29, 2008, at 12:50 PM, Steve McLeod wrote: I tried creating a RunLoop, that runs for 10 seconds, but I still had no joy. I guess I'm still making beginner mistakes. Any ideas from the code below, which now has a RunLoop? One other thing you might need to do is get a window server connection, which you can do by calling NSApplicationLoad() at the start of your program. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Unhilite a window title bar?
Is there a way to remove the hilite from a Cocoa window, so that it no longer looks active, without making some other Cocoa window main or key? Sending the window resignMainWindow and resignKeyWindow doesn't do it. No doubt that sounds like a strange question. I'm looking for a workaround to a Carbon/Cocoa integration bug. -- James W. Walker, Innoventive Software LLC http://www.frameforge3d.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Problem with NSData to NSString to NSData
Dear Cocoa-dev People, First, I wanted to thank Aki Inoue and Rob Keniger for pointing out the problem with my NSData-NSString-NSData approach. As an alternative, would it be fruitful to use a Directory Wrapper to represent the data as two files; one the metadata and the other the pdf? Then I could work with the metadata file, but just display the pdf file. In the What could go wrong here? department, would my compound file end up behaving like a directory (or worse)? Many thanks, Joel Norvell On 2008/10/28, at 21:43, Joel Norvell email_removed wrote: Dear Cocoa-dev People, I have a file with some metadata prepended to a pdf. I want to strip the metadata off and display the pdf. I was trying to do this: - (void) loadFromPath: (NSString *) path { NSData *myData = [NSData dataWithContentsOfFile:path]; NSString *myStr = [[NSString alloc] initWithData:pdfData encoding:NSASCIIStringEncoding]; // I strip off the metadata here, leaving the pdfStr. // Nothing I've tried here has worked: NSData * myNewData = [pdfStr dataUsingEncoding: ???]; // Display the pdf here... } How can I get this to work? Sincerely, Joel Norvell ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Problem with NSData to NSString to NSData
On 30 Oct 2008, at 7:46 am, Joel Norvell wrote: As an alternative, would it be fruitful to use a Directory Wrapper to represent the data as two files; one the metadata and the other the pdf? Then I could work with the metadata file, but just display the pdf file. In the What could go wrong here? department, would my compound file end up behaving like a directory (or worse)? What could be worse? ;-) As long as you set the package bit it will look like a file, as least on OS X. On other file systems it will look like a directory. The problem I think is that your file would cease to be directly openable by any other program that reads PDFs unless they are aware of your package layout, or can drill down into packages, which isn't common. hth, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Open Window from Input Manager
wow, now it my code looks much nicer :-) thank you very much! Daniel On Wed, Oct 29, 2008 at 5:20 PM, Douglas Davidson [EMAIL PROTECTED] wrote: On Oct 29, 2008, at 9:16 AM, Daniel wrote: [NSString stringWithFormat:@%@/Contents/Resources/Chooser.nib, [bundle bundlePath]] I'm afraid I missed the start of this discussion, but this snippet is wrong. It should be [bundle pathForResource:@Chooser ofType:@nib]. Douglas Davidson ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Is there an equivalent to std::min/std::max for Cocoa programmer's
MIN(), MAX() (from Foundation/NSObjCRuntime.h) ? Le 29 oct. 08 à 18:26, Michael A. Crawford a écrit : -Michael___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Problem with NSData to NSString to NSData
On Oct 29, 2008, at 3:46 PM, Joel Norvell wrote: Dear Cocoa-dev People, First, I wanted to thank Aki Inoue and Rob Keniger for pointing out the problem with my NSData-NSString-NSData approach. As an alternative, would it be fruitful to use a Directory Wrapper to represent the data as two files; one the metadata and the other the pdf? Then I could work with the metadata file, but just display the pdf file. In the What could go wrong here? department, would my compound file end up behaving like a directory (or worse)? From your original implementation of putting the metadata directly into the PDF file, you'll now end up with obviously a proprietary file. i.e. No application that works with PDF will be able to work with that file. By having a separate file, things can become fragile. However, the solution here is to use a package type for a custom document. Just as TextEdit does for the rtfd type. Your package folder would then contain the original PDF and a separate file (or files) for your metadata. This document type would most likely not be openable in any app that opens PDF (unless their open dialogs have the 'allow navigation of packages' option set). But, advanced users could your package via Finder and work with the PDF directly if they need to. ___ Ricky A. Sharp mailto:[EMAIL PROTECTED] Instant Interactive(tm) http://www.instantinteractive.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
[MEET] CocoaHeads Mac Developer Meetings
Greetings, CocoaHeads is an international Mac programmer's group. We specialize in Cocoa, but everything Mac programming related is welcome. Why Should I Attend? Meeting other Mac OS X developers in person is both fun and immensely useful. There's no better way to learn Cocoa or get help with problems than being around other people who are writing Mac software. We usually have several Cocoa experts hanging around that are happy to answer whatever questions they can. Bring your laptop and any code you're working on. Everyone is Welcome Meetings are free and open to the public. Feel free to drop in even if you've never attended or aren't currently using Cocoa. We usually have a few new faces, so don't worry about being the odd one out. Upcoming meetings: Canada Ottawa/Gatineau- Thursday November 13, 2008 08:00 PM EDT. Germany Berlin- Thursday November 13, 2008 07:00 PM CEST. Bonn- Thursday November 20, 2008 07:00 PM CEST. Sweden Stockholm- Monday November 03, 2008 07:30 PM CEST. United Kingdom Swindon- Monday November 03, 2008 09:00 PM BST. United States Boston- Thursday November 13, 2008 07:00 PM EDT. Boulder- Tuesday November 11, 2008 08:00 PM MDT. Colorado Springs- Thursday November 13, 2008 07:00 PM MST. Des Monies- Thursday November 13, 2008 07:00 PM CST. Fort Lauderdale- Sunday November 16, 2008 08:00 PM EDT. Minneapolis- Thursday November 13, 2008 06:00 PM CST. Philadelphia- Thursday November 13, 2008 07:00 PM EDT. Provo- Thursday November 13, 2008 07:00 PM MST. St. Louis- Saturday November 22, 2008 02:00 PM CST. Please check the web site at http://cocoaheads.org for more information including last-minute changes. Some chapters may have yet to post their meeting for this month. Steve Silicon Valley CocoaHeads http://cocoaheads.org ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
What's wrong with this font thing?
OK, I have to assume that I'm doing something really wrong here, but man, I sure can't see it. Maybe my understanding is out of whack, maybe some kind soul will show me the light... (Sorry for the length, I'm trying to include all relevant information up front.) I am attempting to replicate an API call that is available on another platform, but not on Mac OS X. The call in question takes a string, a font, a width, and reduces the font size (if necessary) theoretically applied to that string such that when drawn, that string would occupy no more than the specified width (down to a mimimum font size also specified), and then returns the adjusted font size as well as the NSSize that the string would occupy if it were to be drawn with that font at that adjusted size. Here is my version of that routine: - (NSSize)sizeWithFont:(NSFont *)font minFontSize:(CGFloat)minFontSize actualFontSize:(CGFloat *)actualFontSize forWidth:(CGFloat)width { CGFloat pointSize = [font pointSize]; NSDictionary *attrs = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName]; NSSize thisSize = [self sizeWithAttributes:attrs]; if (width 0) { while (pointSize = minFontSize) { attrs = [NSDictionary dictionaryWithObject:[NSFont fontWithName:[font fontName] size:pointSize] forKey:NSFontAttributeName]; thisSize = [self sizeWithAttributes:attrs]; if (thisSize.width = width) { break; } pointSize -= 1.0; } } if (actualFontSize != NULL) { *actualFontSize = (pointSize minFontSize) ? pointSize : minFontSize; } return thisSize; } The font in question at this particular juncture is Arial Bold (NSFont = Arial-BoldMT 16.00 pt. P [] (0x16274640) fobj=0x16262bc0, spc=4.45; says gdb when I 'po font'). The font is originally retrieved by doing [NSFont fontWithName:@Arial-BoldMT size:16.0]. If I start out at a size 20, here are the resulting sizes for a given string: At 20, height = 23 At 19, height = 22 At 18, height = 21 At 17, height = 20 At 16, height = 18 At 15, height = 21 At 14, height = 20 At 13, height = 19 At 12, height = 18 I forced that routine to start at 20 for debugging purposes; the actual font sent in is of size 16, the minimum is 12, and in fact, at 12 the string fits into the specified width. However, when I draw the string at the reduced size using - drawInRect:withAttributes:, the baseline of the string moves; I wanted to adjust for that by using the difference in heights from drawing it big versus drawing it reduced, but there is no difference in heights between 16 and 12. That boggles my mind. Why does the height suddenly jump UP going from 16 down to 15 points? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: What's wrong with this font thing?
On 30 Oct 2008, at 9:45 am, Randall Meadows wrote: Why does the height suddenly jump UP going from 16 down to 15 points? I'm not sure, but could it be that there are thresholds where a different master font is used? As you cross the threshold the system decides to base the font on a different master. A different solution if you know you are just displaying the text is to convert the glyphs to a path and simply scale the path to fit. That way you can scale it utterly smoothly with no jumps or sudden change in appearance. But if you wish to stick with using the Font Manager, wouldn't you be better off doing a binary search for the right size? Gradually shrinking the font to fit could end up being slow especially as there may be all sorts of font loading/caching going on in the font manager. A binary search would also allow you to start at any size and *increase* the font size if necessary as well as decrease it, as well as being the fastest way to get there. Just a thought. hth, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: What's wrong with this font thing?
On Oct 29, 2008, at 3:45 PM, Randall Meadows wrote: OK, I have to assume that I'm doing something really wrong here, but man, I sure can't see it. Maybe my understanding is out of whack, maybe some kind soul will show me the light... (Sorry for the length, I'm trying to include all relevant information up front.) I am attempting to replicate an API call that is available on another platform, but not on Mac OS X. The call in question takes a string, a font, a width, and reduces the font size (if necessary) theoretically applied to that string such that when drawn, that string would occupy no more than the specified width (down to a mimimum font size also specified), and then returns the adjusted font size as well as the NSSize that the string would occupy if it were to be drawn with that font at that adjusted size. Trying to find the right font size to just fit the text seems a bit archaic. Here is a different approach: - Measure the string with some font - Divide the space available by the measured width to find the scale factor - Use CGContextScaleCTM() to apply the scale to the current transform - Draw the string with that font. It will scale nicely and fit into the available space. -Peter ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Is there an equivalent to std::min/std::max for Cocoa programmer's
Thank you. I did try to find these using the help feature in Xcode and the documentation that is included with Xcode but I did not get a hit. I also tried spotlight but no-joy. What is the best way to find equivalent methods like these? Most of my experience is in coding for POSIX/Linux/Unix and Win32/.NET. Though I could have included the C++ standard library, I think it is probably wise not to mix this with Cocoa. -Michael On Oct 29, 2008, at 11:51 AM, Jean-Daniel Dupas wrote: MIN(), MAX() (from Foundation/NSObjCRuntime.h) ? Le 29 oct. 08 à 18:26, Michael A. Crawford a écrit : -Michael___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org This email sent to [EMAIL PROTECTED] smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Is there an equivalent to std::min/std::max for Cocoa programmer's
These are template methods that are included as part of the C++ standard library. They will take any type that supports comparison operators, both arguments must be of the same type. -Michael On Oct 29, 2008, at 10:43 AM, Stig Brautaset wrote: it would help if you explained what these functions (I'm assuming they are functions) do. Do they work on a list, or do they just take two arguments, for example? On 29 Oct 2008, at 17:26, Michael A. Crawford wrote: -Michael___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/stig%40brautaset.org This email sent to [EMAIL PROTECTED] Stig -- http://code.brautaset.org http://devblog.brautaset.org smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Is there an equivalent to std::min/std::max for Cocoa programmer's
On Oct 29, 2008, at 5:19 PM, Michael A. Crawford wrote: Thank you. I did try to find these using the help feature in Xcode and the documentation that is included with Xcode but I did not get a hit. I also tried spotlight but no-joy. What is the best way to find equivalent methods like these? AFAICT, those macros aren't documented. File a bug report. Most of my experience is in coding for POSIX/Linux/Unix and Win32/.NET. Though I could have included the C++ standard library, I think it is probably wise not to mix this with Cocoa. You can use the C++ standard library in Cocoa if you wish, but you must use ObjC++ if you do so. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: What's wrong with this font thing?
- Divide the space available by the measured width to find the scale factor You can also use the scale factor to create a new font with a fractional size. I have the same problem for a terminal emulator - I need the largest fixed font that will fit in a particular character spacing. When I resize the window the sizes jump all over the place and the font is clearly changing in subtle ways. On Oct 29, 2008, at 4:15 PM, Peter Ammon wrote: On Oct 29, 2008, at 3:45 PM, Randall Meadows wrote: OK, I have to assume that I'm doing something really wrong here, but man, I sure can't see it. Maybe my understanding is out of whack, maybe some kind soul will show me the light... (Sorry for the length, I'm trying to include all relevant information up front.) I am attempting to replicate an API call that is available on another platform, but not on Mac OS X. The call in question takes a string, a font, a width, and reduces the font size (if necessary) theoretically applied to that string such that when drawn, that string would occupy no more than the specified width (down to a mimimum font size also specified), and then returns the adjusted font size as well as the NSSize that the string would occupy if it were to be drawn with that font at that adjusted size. Trying to find the right font size to just fit the text seems a bit archaic. Here is a different approach: - Measure the string with some font - Divide the space available by the measured width to find the scale factor - Use CGContextScaleCTM() to apply the scale to the current transform - Draw the string with that font. It will scale nicely and fit into the available space. -Peter ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/buddykurz%40mac.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: What's wrong with this font thing?
On Oct 29, 2008, at 5:15 PM, Peter Ammon wrote: Trying to find the right font size to just fit the text seems a bit archaic. Here is a different approach: - Measure the string with some font - Divide the space available by the measured width to find the scale factor - Use CGContextScaleCTM() to apply the scale to the current transform - Draw the string with that font. It will scale nicely and fit into the available space. Doing that also shifts the rect that I'm trying to draw into. I'm doing multiple NSString drawInRect:withAttributes: calls, all within a single view. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: What's wrong with this font thing?
On 30 Oct 2008, at 10:37 am, Randall Meadows wrote: Doing that also shifts the rect that I'm trying to draw into. I'm doing multiple NSString drawInRect:withAttributes: calls, all within a single view. Remember that transforms are always relative to the view's origin, so just scaling will move the rect. You have to transform to the origin, scale, then transform back to where you want to draw the text. If you were using NSAffineTransform it would go like this: (warning: typed in Mail) NSAffineTransform* transform = [NSAffineTransform transform]; [transform translateXBy:myRect.origin.x yBy:myRect.origin.y]; [transform scaleXBy:myScaleFactor yBy:myScaleFactor]; [transform translateXBy:-myRect.origin.x yBy:-myRect.origin.y]; [transform concat]; If using the CTM methods in Core Graphics, there are equivalent functions. This assumes that the rect's origin is where the text origin is, I can't remember if that's actually the case, but if it isn't then just translate to the necessary point and back. You need to save/restore the graphics state around each drawing call. (BTW Peter's approach is a good one, much easier than converting the glyphs to a path, but with identical results). hth, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: What's wrong with this font thing?
The threshold being discussed here is the boundary between the screen font vs printer font in NSFont jargon. For font size smaller than 16pt, we automatically substitute the default printer font to its corresponding screen font. The metrics gap is caused by the substitution. You can disable the auto-substitution with NSStringDrawingDisableScreenFontSubstitution flag. When you change the scale/font size, the baseline shifts naturally when you layout from the top. In order to keep it fixed at the baseline, you need to layout/render on it. -drawInRect:withAttributes: always render from the top. To render with the baseline, use -drawWithRect:options:attributes:. Aki On 2008/10/29, at 16:37, Randall Meadows wrote: On Oct 29, 2008, at 5:15 PM, Peter Ammon wrote: Trying to find the right font size to just fit the text seems a bit archaic. Here is a different approach: - Measure the string with some font - Divide the space available by the measured width to find the scale factor - Use CGContextScaleCTM() to apply the scale to the current transform - Draw the string with that font. It will scale nicely and fit into the available space. Doing that also shifts the rect that I'm trying to draw into. I'm doing multiple NSString drawInRect:withAttributes: calls, all within a single view. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/aki%40apple.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSTableColumn unbindable when NSSegmentedCell is used?
If you google NSSegmentedCell bindings, the first search result is http://developer.apple.com/documentation/Cocoa/Reference/ CocoaBindingsRef/BindingsText/NSSegmentedCell.html I'm guessing you want selectedIndex or selectedLabel or selectedTag. On Oct 29, 2008, at 2:23 AM, Mike Laurence wrote: Hello, I'm migrating a non-binding version of an NSTableView over to a binded version. In the non-binding version (using a data source), one of my table columns used a subclass of NSSegmentedCell, and I merely overrode setObjectValue in order to capture the data and set the number of segments, their labels, etc. In the binded version, I have successfully converted all of the text field cells - each NSTableColumn has a 'value' binding, which I set to [controller.arrangedObjects.key], and I'm able to see all of my text data just fine. However, the NSTableColumn containing my NSSegmentedCell subclass mysteriously lacks a 'value' binding, and I'm unable to fathom how to set the data inside of it. Can anyone point me to the correct way to bind my arrangedObjects to those NSSegmentedCells? Thanks very much! Regards, Mike Laurence ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/dave.fernandes% 40utoronto.ca This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Static text over an image
Hi, I want to have text over an image. Even though I set it up in IB (move image to the back, bring the label to the front), the label is always drawn behind the image. Is there a setting to be set in IB for that or do I have to draw the text myself? Thanks, Andre Masse ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Static text over an image
On 30/10/2008, at 2:48 PM, Andre Masse wrote: I want to have text over an image. Even though I set it up in IB (move image to the back, bring the label to the front), the label is always drawn behind the image. Is there a setting to be set in IB for that or do I have to draw the text myself? Try double-clicking the Image view in IB, which will move IB's active selection to the view itself. If you now drag a text field to the image, it will be placed as a subview of the NSImageView and always display in front. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Static text over an image
I've seen it happen a few times where views will be layered in the reverse order that they're set to in IB. Try moving the label behind the image and see if that gives you the desired result. Cheers, Brandon On 30-Oct-08, at 12:48 AM, Andre Masse wrote: Hi, I want to have text over an image. Even though I set it up in IB (move image to the back, bring the label to the front), the label is always drawn behind the image. Is there a setting to be set in IB for that or do I have to draw the text myself? Thanks, Andre Masse ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/bwalkin%40gmail.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]