Re: machine with null serial number?
Indeed it is almost always when a mac has had the logic board replaced/repaired. It does occur. Sometimes even a new batch of macs may ship without serial numbers or even with a system profiler depicting the wrong system. It's pretty rare, but does happen, so it may not be the best thing to tie in to for a software licensing scheme. You'd be much better off being a bit more generous or at least trusting with your licensing. Apple is certainly pretty fair about putting most of their software on a good faith licensing scheme. Heck, they're not even to stringent about academic pricing! You might consider using something more reliable for licensing like simply hashing the customer's name and purchase date or other info. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: machine with null serial number?
Indeed, on repair, the computer should have the old serial number. This is why it is also located on the case, exact location depends on the model. The only time there should ever be a new serial number is when a Mac is outright replaced. Definitely, it is a bad idea to depend on the serial number at all for software. MAC addresses are not entirely difficult to spoof either. The best case is to either have users register the product, the Microsoft way, or simply accept that a certain level of piracy is inevitable with desirable software. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: setMenuVisible
On 27.03.2008, at 08:24, Wesley Smith wrote: I'm trying to make an NSWindow that takes up the entire screen including the menu bar but is not actually a fullscreen window. I know this is possible with Carbon, but I can't figure it out with Cocoa. Whenever I call [NSMenu setMenuVisible:TRUE], the menubar goes away, but so does my window. maybe you really want setMenuBarVisible:(BOOL)visible NSMenu class method ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Custom Buttons - Tutorial/Examples...
Does anybody know a tutorial or example on creating custom buttons in Cocoa? I can certainly set an image in IB or programmatically, but how can I determine the actual hitmask? Or even set the mouseOver type of event for something like a rollover ? I know I'm talking about stepping on Apple's HIG, but it is something I'd like to know how to do without delving into CG or CA right now. I've been toying with it a bit today, and I can certainly set the images, but on mouse down, the background changes to the image with a darkened state inside of a white rectangle... surely I'm missing something stupidly obvious...? Any tips or links are greatly appreciated! Cheers, JJ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Capture youtube image in webview
You may need to try a different method. The keyboard shortcuts for taking screenshots, as well as the bundled application Grab, are both capable of making an image that includes flash video in a web view. You might simply do it with AppleScript... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Forced Refreshing of WebKit
On Apr 14, 2008, at 2:02 PM, [EMAIL PROTECTED] wrote: Forced Refreshing of WebKit To force refresh a WebKit view, do the same thing web developers do: JavaScript...? or - reload: example from webview docs: - (IBAction)reload:(id)sender ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
After Unarchive Object Exists, After First GUI Action, gone...
I apologize for the beginner nature of this, I must be missing something obvious, but I cannot see it. Archiving works fine. The data is there. I've inserted NSLogs everywhere to no avail. When the file is opened (unarchived) the log showed me the first object in my array has the correct data. But the data for the first object in the array (all are NSStrings) never appears in the textView. Something is erasing or emptying the contents of this string somewhere between unarchiving and display. The other array objects are unaffected. Here's my implementation file (most of it) Please help me see what's wrong here... #import "MyDocument.h" @implementation MyDocument - (id)init { self = [super init]; if (self) { stickitNotes = [[NSMutableArray alloc] init]; StickitNote *aNote = [[StickitNote alloc] init]; [stickitNotes insertObject:aNote atIndex:0]; currentNoteIndex = [stickitNotes indexOfObject:aNote]; } return self; } - (NSString *)windowNibName { return @"MyDocument"; } - (void)windowControllerDidLoadNib:(NSWindowController *) aController { [super windowControllerDidLoadNib:aController]; // Add any code here that needs to be executed once the windowController has loaded the document's window. } - (NSData *)dataRepresentationOfType:(NSString *)aType { return [NSKeyedArchiver archivedDataWithRootObject:stickitNotes]; } - (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)aType { NSMutableArray *newArray; newArray = [NSKeyedUnarchiver unarchiveObjectWithData:data]; if (newArray == nil) { [textView setString:[[stickitNotes objectAtIndex:currentNoteIndex] noteBody]]; [textView setNeedsDisplay:YES]; return NO; } else { [self setStickitNotes:newArray]; [textView setString:[[stickitNotes objectAtIndex:currentNoteIndex] noteBody]]; [textView setNeedsDisplay:YES]; return YES; } } - (void)newNote:(id)sender { [[stickitNotes objectAtIndex:currentNoteIndex] setNoteBody:[textView string]]; StickitNote *aNote = [[StickitNote alloc] init]; [stickitNotes insertObject:aNote atIndex:[stickitNotes count]]; currentNoteIndex = [stickitNotes indexOfObject:aNote]; /* set textView to display current note */ [textView setString:[[stickitNotes objectAtIndex:currentNoteIndex] noteBody]]; [textView setNeedsDisplay:YES]; } - (void)nextNote:(id)sender { unsigned int nextNote; if (currentNoteIndex == ([stickitNotes count] - 1)) { nextNote = 0; } else { nextNote = currentNoteIndex + 1; } [[stickitNotes objectAtIndex:currentNoteIndex] setNoteBody:[textView string]]; currentNoteIndex = nextNote; [textView setString:[[stickitNotes objectAtIndex:currentNoteIndex] noteBody]]; [textView setNeedsDisplay:YES]; } - (void)previousNote:(id)sender { unsigned int prevNote; if (currentNoteIndex == 0) { prevNote = ([stickitNotes count] - 1); } else { prevNote = currentNoteIndex - 1; } [[stickitNotes objectAtIndex:currentNoteIndex] setNoteBody:[textView string]]; currentNoteIndex = prevNote; [textView setString:[[stickitNotes objectAtIndex:currentNoteIndex] noteBody]]; [textView setNeedsDisplay:YES]; } - (void)setStickitNotes:(NSMutableArray *)array { if (array == stickitNotes) return; //skips if it is same data? [stickitNotes release]; [array retain]; stickitNotes = array; [textView setString:[stickitNotes objectAtIndex:0]]; } @end ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: After Unarchive Object Exists, After First GUI Action, gone...
Looks like I found a solution... anyone please let me know if my solution stinks. (or any of the rest of this thing!) In the method - (void)windowControllerDidLoadNib:(NSWindowController *) aController I added this: [textView setString:[[stickitNotes objectAtIndex:0] noteBody]]; #import "MyDocument.h" @implementation MyDocument - (id)init { self = [super init]; if (self) { stickitNotes = [[NSMutableArray alloc] init]; StickitNote *aNote = [[StickitNote alloc] init]; [stickitNotes insertObject:aNote atIndex:0]; currentNoteIndex = [stickitNotes indexOfObject:aNote]; } return self; } - (NSString *)windowNibName { return @"MyDocument"; } - (void)windowControllerDidLoadNib:(NSWindowController *) aController { [super windowControllerDidLoadNib:aController]; // Add any code here that needs to be executed once the windowController has loaded the document's window. } - (NSData *)dataRepresentationOfType:(NSString *)aType { return [NSKeyedArchiver archivedDataWithRootObject:stickitNotes]; } - (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)aType { NSMutableArray *newArray; newArray = [NSKeyedUnarchiver unarchiveObjectWithData:data]; if (newArray == nil) { [textView setString:[[stickitNotes objectAtIndex:currentNoteIndex] noteBody]]; [textView setNeedsDisplay:YES]; return NO; } else { [self setStickitNotes:newArray]; [textView setString:[[stickitNotes objectAtIndex:currentNoteIndex] noteBody]]; [textView setNeedsDisplay:YES]; return YES; } } - (void)newNote:(id)sender { [[stickitNotes objectAtIndex:currentNoteIndex] setNoteBody: [textView string]]; StickitNote *aNote = [[StickitNote alloc] init]; [stickitNotes insertObject:aNote atIndex:[stickitNotes count]]; currentNoteIndex = [stickitNotes indexOfObject:aNote]; /* set textView to display current note */ [textView setString:[[stickitNotes objectAtIndex:currentNoteIndex] noteBody]]; [textView setNeedsDisplay:YES]; } - (void)nextNote:(id)sender { unsigned int nextNote; if (currentNoteIndex == ([stickitNotes count] - 1)) { nextNote = 0; } else { nextNote = currentNoteIndex + 1; } [[stickitNotes objectAtIndex:currentNoteIndex] setNoteBody: [textView string]]; currentNoteIndex = nextNote; [textView setString:[[stickitNotes objectAtIndex:currentNoteIndex] noteBody]]; [textView setNeedsDisplay:YES]; } - (void)previousNote:(id)sender { unsigned int prevNote; if (currentNoteIndex == 0) { prevNote = ([stickitNotes count] - 1); } else { prevNote = currentNoteIndex - 1; } [[stickitNotes objectAtIndex:currentNoteIndex] setNoteBody: [textView string]]; currentNoteIndex = prevNote; [textView setString:[[stickitNotes objectAtIndex:currentNoteIndex] noteBody]]; [textView setNeedsDisplay:YES]; } - (void)setStickitNotes:(NSMutableArray *)array { if (array == stickitNotes) return; //skips if it is same data? [stickitNotes release]; [array retain]; stickitNotes = array; [textView setString:[stickitNotes objectAtIndex:0]]; } @end ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: After Unarchive Object Exists, After First GUI Action, gone...
On Apr 21, 2008, at 6:45 AM, [EMAIL PROTECTED] wrote: Date: Mon, 21 Apr 2008 01:16:56 -0700 From: Andrew Farmer <[EMAIL PROTECTED]> Subject: Re: After Unarchive Object Exists, After First GUI Action, gone... To: John Joyce <[EMAIL PROTECTED]> Cc: cocoa-dev@lists.apple.com Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes On 20 Apr 08, at 18:55, John Joyce wrote: Looks like I found a solution... anyone please let me know if my solution stinks. (or any of the rest of this thing!) In the method - (void)windowControllerDidLoadNib:(NSWindowController *) aController I added this: [textView setString:[[stickitNotes objectAtIndex:0] noteBody]]; A few general notes: 1. You should never have to call setNeedsDisplay: on anything except self (in NSView subclasses). A properly written view will do that on its own when its contents change. 2. There's a lot of duplication in your code. You should probably factor out some common code into a new method (updateCurrentNotes? setNoteIndex?). Alternatively, you may want to take a look at Cocoa Bindings - in particular, NSArrayController - which should be able to do a lot of this work for you. Thanks Andrew, yep, that's where I picked up setNeedsDisplay, so I was just trying it to see if I was missing something. As for the duplication, yeah, I am aware of it, but refactoring can come in after functionality for this. I've worked with Ruby a lot so I'm willing to write rough drafts and fix it later. I agree and was thinking that Bindings would possibly be the way to go for this. I actually just lifted large bits of the thing from the Hillegass book's RaiseMan application, which is a terrible app that introduces a lot of different elements of Cocoa at once. the trickiest part of bindings seems to me to be the key paths. Getting those right (and some of the settings in the inspector palette in IB) is a bit mysterious. Do bindings rely mainly on NSDictionary or do they work well with NSArray too? In this case, I'm building a note app to replace stickies for a very specific workflow. I just need it to be fast and stable with a small footprint. Things could be refactored to use dictionaries for more meta data, and probably will be, but NSArray seems to be the fastest lookup and is already sequential. But for now I'm just trying to wrap my head around enough of the Cocoa basics. In particular, after Ruby (not even Rails necessarily) I feel quite comfortable with Objective C and Cocoa, but sometimes I feel like methods I should have are not there, or I can't guess the name of them. It's probably me thinking Ruby, but I often feel like I'm just missing methods for NSArray... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: [Ann] DMG Canvas
Is there a way using this tool or even programmatically, to have disk images mount without having the collapsed toolbar? The biggest user confusion I see is that they do not even recognize it to be a window since most users don't even know what that capsule shaped button does. There is definitely a big gulf of knowledge that all of us should be working to educate users about, albeit in subtle ways. We should all be making subtle efforts to convince users that they want to and need to learn more. This reduces support costs. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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 is "Apple + Ctrl + D" implemented?
Graham, Thanks for your reply! But how can I "find the range of the word" given the glyph index? I just can not find an API doing so. So I don't think this is the underlying implementation. Any comments from others? The range of the word is up to you to find and depends on the language. If it is any common language from Europe, your job is a lot easier. You mainly need to work with whitespace and punctuation. If you're working with Japanese, you'll need to learn of lot of complex tricks to identify the range of words... As for the implementation of the keyboard shortcut, you'll find it appears in Sys Prefs > Keyboard & Mouse > Keyboard Shortcuts , Dictionary. That being the case, it is possible to turn off the existing shortcut. It may not be feasible or reliable to do so programmatically. Apple is free to set these shortcuts to anything at any time and at any level. You may need to instruct your users on how to change the keyboard shortcut(s). The hard part is finding something available. Some things are taken up system wide, some are taken up on within apps. The only way to wrest control of these is with an input manager, but that may not be worth the trouble. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Cocoa-dev Digest, Vol 5, Issue 727
I'm struggling and maybe tired, but how do you set the state of and NSMatrix with radio buttons and NSPopUpButton ? Does it go in windowDidLoad or should it be in awakeFromNIB ? This is in a Preference window for my app. I'm having a hard time figuring out how to get it to set state to reflect the userDefaults. No trouble with changing the defaults after a selection, just reflecting the current defaults on load of the window. What methods am I missing? For the popup, I have tried selectItemWithTitle, selectItemWithTag, etc... For the radio button matrix, I am totally lost and I don't understand how to set the state of it. Does the matrix need IBOutlets for each cell too? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Trouble using NSMatrix with radiobuttons and using NSPopUp buttons
(sorry for the repost, I forgot to change the subject line before) I'm struggling and maybe tired, but how do you set the state of and NSMatrix with radio buttons and NSPopUpButton ? Does it go in windowDidLoad or should it be in awakeFromNIB ? This is in a Preference window for my app. I'm having a hard time figuring out how to get it to set state to reflect the userDefaults. No trouble with changing the defaults after a selection, just reflecting the current defaults on load of the window. What methods am I missing? For the popup, I have tried selectItemWithTitle, selectItemWithTag, etc... For the radio button matrix, I am totally lost and I don't understand how to set the state of it. Does the matrix need IBOutlets for each cell too? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Saving as xml
What's the best method to save a document as xml? Should NSKeyedArchiver be doing this? My document and its objects are very simple, they can easily be nothing more than BOOLs and NSStrings (as keys). Other issue: If I have an NSDictionary (composed of two NSArrays' objects, keysArray, objectArray) that I want to use as a constant of sorts for all documents and controllers in a document-based app, is there a recommended way to declare the dictionary or a file it should go in? Should it belong to my instance of NSApp to make it available to all objects in the app? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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 getting subclass of NSTextContainer working properly [SOLVED]
Graham, that would be very cool to have posted here! If nothing else, it will be in the archive for others who run into it. (I'm in agreement about the clarity of a large number of docs... there often seems to be a circular relationship of what you need to understand before being able to understand docs on many topics.) Otherwise, it would make a great blog post with the graphics you linked earlier too. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Xcode-like window menu?
Gerd, What XCode probably does, is simply switch documents, rather than switching windows. But yes, you probably need to programmatically interact with your NSDocument, NSDocumentController, NSWindowController objects. remember the hierarchy NSDocumentController > NSDocument (multiple distinct document instances possible) > NSWindowController (multiple instances possible within a document for multi-window documents). Responder-chain. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Save as and Open conditional code samples? tutorials?
Does anybody have any code samples or tutorials on opening/saving documents with conditional handling for different file types? Conceptually, handling the content is not a problem. The thing I'm not sure about is how to hook up a document-based app to handle additional file types but with the preferred native document type. My app's documents are little more than an array of strings, where each string is a sub document. The thing I want to do is export all as a single text file or as individual text files, and likewise import a text file with simple string symbols as separators (basically like a CSV file). Handling the text and doing things with it is easy. I just don't know what sort of design patterns exist for handling additional file types. thanks in advance John Joyce ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Cocoa bindings and reluctance to use NSPopupButon
Johnny Lundy had a difficult time using NSPopupButon along with bindings. The struggles are archived via www.cocoabuilder.com for posterity. Mr. Lundy recently wrote "...I am still very very hesitant to put another NSPopUpButton on my interface, because of the complete absence of guidance on how to implement the thing, and the many days it took to get a single one working, and even now I have no idea why it works..." Having just now re-read Mr. Lundy's questions and follow-up, I don't think he had any problem with NSPopupButton at all. That makes sense because NSPopupButton is not particularly difficult to use. I think Mr. Lundy's struggles were all with "bindings." Had I been inclined to participate in the threads at the time, I would have said the following: 1) Bindings are an ADVANCED technique that was recently introduced and not yet completely documented. If someone tries to use bindings in a situation where he/she doesn't already know how to write the application without bindings, it is a mistake to use bindings. 2) Bindings exist to _reduce_ the amount of Controller code needed when the Model View Controller pattern is used. Bindings don't eliminate controller code and can't handle all Controller responsibilities. 3) Bindings appear to be magic, but they are in fact just an abstraction that enables reuse in place of commonly re-written controller code. 4) Bindings ARE NOT A REPLACEMENT FOR ALL CONTROLLER CODE, and bindings are often not the best technique to use. Mr. Lundy would have been better off writing his controller code explicitly and using the established outlet, target and action patterns instead of bindings. Not only would he have achieved complete control over all aspects of his application's behavior, he would have gained insight into how, and and why bindings work or not. I find that I hardly ever use bindings in my own applications. I am more comfortable doing things the good old fashion way in part because I often want very fine control over application behavior. I blame Mr. Lundy's specific struggles on misguided insistence on using the wrong tool for the job. I counsel Cocoa newbies to just forget about the Bindings inspector in Interface Builder and pretend they don't exist. Thank you Erik! That's what I had concluded at one point, and then felt pushed back towards. People often said, "you should just use bindings", but I felt I did need to first understand how it works without bindings... With tableViews and treeViews, I can totally see where bindings would simplify a lot of things, but still... the bindings docs are still tough reading. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Hillegass Book 3rd ed. ScreenShots differ?
Maybe this should go to the XCode list, but I know there was much talk about the 3rd edition of "the" book here. Anyway, I'm sitting down with my new Mac, and the 3rd ed. of the Hillegass book, and the thing I notice is that when starting a New Project, the window for selecting an XCode template still appears basically the same as in XCode 2.x, but in the Hillagass book the screenshot shows something more graphical, more in line with iWork template selection screens... (yes it IS XCode 3, not 2.5) So is that screenshot from the prerelease version or something? Or is there a way to turn it on? Also, from the Documentation window, there are update buttons for the docs, but they do not appear to work successfully with a free ADC membership... (yes, I can log in to the ADC site, no problem) Anybody else notice these things? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Hillegass Book 3rd ed. ScreenShots differ?
XCode 3.1? thanks all! That much is enough to be reassuring. I was simply wondering if I had some Preference setting off, or if there was an update I wasn't finding with the changes to the ADC site. As I work at Apple, I respect the list rules and NDAs. (and I only use prerelease if I'm told to) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Transparent content view of NSWindow clicks through
I'm toying with using a transparent content view of an NSWindow. Of course, when you get the background totally transparent, you click in the rect, it clicks through to activate whatever is behind the window. Does anybody know a way to have that much transparency and not click through? I'm sure it's possible to render a background image that is whatever is behind the window, but that might eat up more processing than would be practical. (yes, I have gone over the sample code, RoundTransparentWindow ) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Core Data : BlogDemo tutorial : I must have missed something, but I don't know what...
I just worked through the BlogDemo core data app tutorial. The "Topics" panel loads of course, but none of the "Topics" functionality is there. I'm sure I've missed something, or mis-connected something, but I cannot seem to find it... When I run the demo app, I'm getting the following : [Session started at 2008-06-21 16:27:03 -0500.] 2008-06-21 16:27:05.212 BlogDemo[1180] *** NSRunLoop ignoring exception '[ valueForUndefinedKey:]: this class is not key value coding-compliant for the key topic.' that raised during posting of delayed perform with target 3c4ac0 and selector 'invokeWithTarget:' 2008-06-21 16:27:05.244 BlogDemo[1180] *** NSRunLoop ignoring exception 'Cannot perform operation since entity with name '(null)' cannot be found' that raised during posting of delayed perform with target 3c4c80 and selector 'invokeWithTarget:' Any ideas from this as to what I fumbled? Everything else is working. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Core Data : BlogDemo tutorial : I must have missed something, but I don't know what...
On Sat, Jun 21, 2008 at 5:12 PM, Jens Alfke <[EMAIL PROTECTED]> wrote: > > On 21 Jun '08, at 2:40 PM, John Joyce wrote: > > 2008-06-21 16:27:05.212 BlogDemo[1180] *** NSRunLoop ignoring exception >> '[ valueForUndefinedKey:]: this class is not key >> value coding-compliant for the key topic.' that raised during posting of >> delayed perform with target 3c4ac0 and selector 'invokeWithTarget:' >> > > This shows that an exception got raised, which is likely to screw up > anything past that point. The message shows that something tried to access > the value for key "topic" on a managed object that didn't support it. > > [Or is the key name really "topic." with a period? I'm not sure whether the > period in the message is part of the key name. Try searching for "topic." in > your code to see if you have a spurious period.] > > If that doesn't narrow it down enough, set a breakpoint at > objc_exception_throw (using the breakpoints window) to find out exactly > where the exception gets thrown. > > —Jens I found the bug! Turns out, I forgot to put anything in the Entity Name field in the Attributes Inspector for the NSArrayController for Topics. The field was blank, but should have been "Topic".Wow. What a horrible little bug to track down. I hope the workflow of Core Data is much cleaner in Interface Builder 3 (when my MacBook returns from repairs...) It certainly seems to me that in XCode 2.x, the Interface Builder workflow for Core Data is not the best it could be for Core Data. The Data Modeler is pretty nice. I found myself thinking Ruby on Rails' ActiveRecord needs something that visual. Unfortunately for Core Data, all of the various settings (that need to be correct and correspond to each other) are spread out and within so many different views of the Inspector palette, it can be hard to make sure you have everything correct. Maybe it comes with experience, but something tells me there could be a more concise way to view and work with these things in Core Data. Ruby on Rails' ActiveRecord sometimes suffers a similar problem. The code feels a bit like spaghetti code (think old BASIC from the 80's with goto statements). I do believe the programmer should and could easily be alerted that there is no Entity Name set! Obviously, the Entity Name is crucial to making Core Data controllers work. (anyway, thanks 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 [EMAIL PROTECTED]
NSScrollView responding to changes in alpha
Interestingly, NSScrollView in an NSPanel HUD window can have its background color set with alpha and transparency is easy to achieve. Inside a normal NSPanel or window, the backing of the contentView rect seems to be all that will mix with the background color alpha. Ideally, I'd like this same behavior with a non-HUD panel or window. Also, HUD panels seem to want to remain in front. Does anybody know a quick way to disable that? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Loading a different interface
In my application, I would like to give my users the option to choose various interface styles. I've laid out my interface using a standard NSPanel as well as the HUD version. Both are suitable, but some users will prefer one over the other, of course. Currently, I have both windows in one NIB. Is there a way to choose which window is loaded from the NIB? Is it possible to do this without losing the data in the document? (it is document based) Would it be better/more practical to factor these into two different NIBs? Also, on the same subject, is there a way to force a HUD window to display the zoom and minimize buttons? Lastly, I have envisioned the possibility of simply having an info button like in Dashboard widgets and providing functionality similar to Dashboard widgets for flipping the window around to adjust the settings of the window. Does anybody already know of some open source example doing something similar? cheers, John Joyce ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Loading a different interface
On Jul 5, 2008, at 3:53 PM, Chris Hanson wrote: On Jul 5, 2008, at 8:30 AM, John Joyce wrote: In my application, I would like to give my users the option to choose various interface styles. I've laid out my interface using a standard NSPanel as well as the HUD version. Both are suitable, but some users will prefer one over the other, of course. Currently, I have both windows in one NIB. Is there a way to choose which window is loaded from the NIB? Is it possible to do this without losing the data in the document? (it is document based) Would it be better/more practical to factor these into two different NIBs? Yes. Refactor your interface into two nibs, where each nib is owned by an NSWindowController rather than by an NSDocument subclass. Then you can override -[NSDocument makeWindowControllers] in your NSDocument subclass to instantiate whichever NSWindowController is initially appropriate, and when you want to "switch" interface styles you can use -[NSDocument addWindowController:] and - [NSDocument removeWindowController:] to get rid of the old and add the new. -- Chris Thanks Chris, this leads me pretty much where I suspected I would end up going. One other thing, does this mean I need to subclass NSWindowController as well? Or simply create instances of the default NSWindowController and feed them as necessary? Either way, from my NSDocument subclass (MyDocument as usual) I should be able to instantiate more than one window controller, and then load my respective NIBs by [NSDocument addWindowController:aWindowController] Will adding a window controller release / close the current window? Clearly, I'm heading down the path of becoming more acquainted with NSWindowController, which seems inevitable if one wishes to do interesting things with the interface. I figured as much. Perhaps this means I'm beginning to grasp more of the AppKit. It does look like it will take a little experimentation to get precisely what I want, but that's cool, it means I will be more aware of how to do interesting things! -- John Joyce ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Importing Xcode 2.x projects into Xcode 3
Are there any caveats when importing an XCode 2.x project into XCode 3? I seem to have NIBs that are no longer connected properly... It could be something I did (or did not do properly), but just curious if anybody else has had any issues. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Binding NSArrayController's objects to an NSTextView
I'm trying to learn to use bindings. Right now, I'm adapting the venerable RaiseMan example in the 3rd edition of Mr. Hillegass' book. Of course, in RaiseMan, the NSArrayController and the corresponding array and its objects are bound to a table view. What I'm trying to do is bind to an NSTextView that is the backing of an NSScrollView. Each object in my array has its own @properties, of course. Each object has an NSString in it, which I want to use as the text for the TextView. Just to see what happens, in my nib I've got these bound both to a table view as well as a text view. The table view behaves as you would expect. The text view gives really bizarre results. It resembles an NSLog description of an array. Editing directly in it, gives identical changes to all objects in the array. Sometimes the results of editing directly in the text view are just strange! Any tips on how this should be done? Am I possibly missing something in my key path or missing some other intermediary thing? The code is identical to the 3rd edition RaiseMan, but with no numeric values, only working with strings. (thus the table view has only one column and headings are not important.) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Binding NSArrayController's objects to an NSTextView
I'm trying to learn to use bindings. Right now, I'm adapting the venerable RaiseMan example in the 3rd edition of Mr. Hillegass' book. Of course, in RaiseMan, the NSArrayController and the corresponding array and its objects are bound to a table view. What I'm trying to do is bind to an NSTextView that is the backing of an NSScrollView. Each object in my array has its own @properties, of course. Each object has an NSString in it, which I want to use as the text for the TextView. Just to see what happens, in my nib I've got these bound both to a table view as well as a text view. The table view behaves as you would expect. The text view gives really bizarre results. It resembles an NSLog description of an array. Editing directly in it, gives identical changes to all objects in the array. Sometimes the results of editing directly in the text view are just strange! Any tips on how this should be done? Am I possibly missing something in my key path or missing some other intermediary thing? The code is identical to the 3rd edition RaiseMan, but with no numeric values, only working with strings. (thus the table view has only one column and headings are not important.) Oops, perhaps I mailed too soon! Somethings became apparent by tinkering. Changing the Controler Key to 'selection' rather than 'arrangedObjects' seems to make a big difference. I'm still finding bindings to be a bit mystifying. I know what they're doing conceptually. I just don't get the lingo used and some of the organization used. It sure would be nice if there was some sort of humanly intuitive version more like Ruby and Rails and ActiveRecord things... (maybe when MacRuby comes around) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
NSPopupButton and bindings to NSArrayController
When attempting to use NSPopupButton and bindings to NSArrayController, as a means to navigate an array of objects, is there any tutorial or example out there? I keep getting "cannot perform operation without a managed object context" This would seem to imply that I should be using CoreData. Is CoreData really the way to go when trying to do much more with bindings ? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSPopupButton and bindings to NSArrayController
On Jul 27, 2008, at 9:56 PM, [EMAIL PROTECTED] wrote: When attempting to use NSPopupButton and bindings to NSArrayController, as a means to navigate an array of objects, is there any tutorial or example out there? I don't believe specifically for your case (ie, an NSPopUpButton), but this list's archives contain various (attempts at) textual explanations. I keep getting "cannot perform operation without a managed object context" This would seem to imply that I should be using CoreData. In Interface Builder, inspect the Attributes of your array controller. You'll see a mode control that lets you specify whether to use a Class or an Entity. You most likely have Entity selected (which requires a MOC, as the error says). Select "Class" instead. Is CoreData really the way to go when trying to do much more with bindings ? No. The two interoperate very well by design but are not mutually inclusive. -- I.S. Well, I already checked that, it is Class, not Entity. I'm already aware that Entity is used with Core Data models. Oh, well, I'll figure something out. I always have a terrible time with NSPopupButton in any context. NSArrayController provides some nifty methods, selectNext: and selectPrevious: but I need a select: that chooses a specific item from the array. Either by index or what have you. I did find setSelectionIndex: in NSArrayController's header, but I had to do some awkward things to make it work. I created an IBOutlet for my array controller, set the Interface Builder instance as that outlet, then was able to set the action of the NSPopupButton to a method in MyDocument which wraps setSelectionIndex: and passes the selection from the NSPopupButton to it. Obviously, I've already built this app with my own glue code. So I know how it can work. I've got my own reference, I just need to make more sense of bindings to make the NSPopupButton sync well with my array of text objects. My textView should change its contents to match selection. I can create new objects for the view. Heck, I can even make it work mostly, using a simple, single column tableView to do selections, but that gives trouble with nextKeyView. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Porting from Windows to Mac
There are many great examples of well-made cross-platform apps out there. One of the best examples I've seen, even in terms of code and organization.. VLC player! It's open source so you can see how they manage things. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Notification Vs Delegation
This may be a pointless and silly question, but is Delegation faster than Notification (generally) ? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Full screen filters
Is there anything documented on what is and is not functional when a view becomes full screen? I have a view that when set to be very very transparent, only appears dark in full screen mode. What I'd like to do is create a layer on top of the screen to apply image filters / effects but still be able to interact with the system normally otherwise. (mouse events, keyboard events, etc... should work as though the screen is normal and any other app is running and is active) This is probably the wrong approach. Does anybody know how to apply CI filters or something like that to the whole screen? Sample code in this vein would be wonderful... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSGraphiteControlTint in app
Hello, I don't think the method setControlTint is the solution I'm looking for, because only a few classes have such a method, NSWindow doesn't. Maybe my question was to general. Is there a way without using private methods to set the complete appearance of an application to NSGraphiteControlTint, although the control tint in System Preference is set to NSBlueControlTint. I understand how important the appearance is to mac apps. But the NSGraphiteControlTint is used by some apps to give them a "pro-app" appearance. Do you really drag Apples "pro-apps" like Aperture into the trash, because they look different? ;-) I think for some few apps it is okay to violate the "Aqua-HIG". Aperture for example wouldn't look so great with a blue aqua appearance. Thanks, Ralph. Pro-Apps (FCP, Motion, etc...) use ProKit rather than AppKit and it is all private. iTunes has its own widgets it seems. iMovie may be somewhere in between. If you're wanting the look of any of those, you'll need to do one of 2 things: - build your own controls - use some controls somebody else built ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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 are we supposed to retrieve the generic bundle icon?
On Nov 11, 2008, at 4:29 PM, [EMAIL PROTECTED] wrote: Subject: Re: RE : How are we supposed to retrieve the generic bundle icon? To: Iceberg-Dev <[EMAIL PROTECTED]> Cc: cocoa-dev@lists.apple.com Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=ISO-8859-1 On Tue, Nov 11, 2008 at 2:50 PM, Iceberg-Dev <[EMAIL PROTECTED]> wrote: Standard Apple Plugins that use this icon. Yes, I'm sure. Are you attempting to use this icon for your own purposes, like plugins for your own app? If so, Apple used to provide a set of icon templates in Photoshop format that you can customize and associate with your app's own plugin bundle UTI. You can find a copy of it at http://www.cocoadev.com/index.pl?AquaIconKit . It only contains templates up to 128x128, but you can scale up the 128x128 template to 512x512 to get the layout right, then apply your customizations on top of the 512x512 image from the standard bundle icns file. --Kyle Sluder Better than that, every OS X system has all the icons you'll need to get started. Here's a bit of Ruby that will help you get all the icons you need to adjust... (it's not clean or pretty, but it worked for me for what I needed. You may need to escape spaces in file/dir names... CoreServices is the source of a large number of icons... sips is an osx command line tool with an undocumented ability to convert icns files to image formats...) # script to get icon files from mac os x apps! # by John Joyce # you can modify and toy with it as needed... puts "enter the source directory:" source_dir = gets.chomp source_dir = File.expand_path source_dir # Check for source_dir existence? puts "Source," if File.exists? source_dir puts "...exists" if File.directory? source_dir puts "...is a directory" end puts "#{source_dir} is valid..." else puts "#{source_dir} does not exist. Check the spelling...?" exit end # source_dir.gsub!(' ','\ ') Dir.chdir(source_dir) file_array = Dir.glob('*') icns_array = [] if file_array.length > 0 puts "files here: #{file_array.length}" file_array.each do |e| if File.extname( e ) == '.icns' puts "#{e} is an icon" icns_array << e end end puts "icns files: #{icns_array.length}" puts icns_array.inspect else puts "nothing in #{source_dir}" exit end if icns_array.length > 0 puts "enter the destination directory:" destination_dir = gets.chomp destination_dir = File.expand_path destination_dir # Check for destination_dir existence? puts "Destination," if File.exists? destination_dir and File.directory? destination_dir # Check for ending '/' or not if destination_dir[destination_dir.length - 1, destination_dir.length] != '/' destination_dir += '/' end puts "#{destination_dir} is valid..." puts "directory named Images-from-icons will be created..." new_dir = "Images-from-icons-" + Time.now.strftime("%Y-%m-%d-%H%M %S") + "/" new_dir = destination_dir + new_dir Dir.mkdir(new_dir) else puts "#{destination_dir} does not exist. Check the spelling...?" exit end icns_array.each do |e| if File.extname( e ) == '.icns' e_name = e.gsub('.icns','') `sips -s format png #{e} --out #{new_dir}#{e_name}.png` end #if end #.each else puts "no .icns files in #{source_dir}" end ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Binding a CoreData string value to an NSTextView
Has anyone had any success Binding a CoreData string value to an NSTextView? Everything I try seems to be flumoxed by the NSAttributedString of the NSTextStorage backing store. The lame thing is this: in code, it is easy to [aTextView setString: (NSString*)aString] or [aTextView string] So what's a reliable way to do the same thing but use a coredata string attribute as the source and destination here? Ideally with bindings to keep everything super clean. If need be, I can of course build some intermediary object. I'm not interested in attributes, but the intermediary idea may make this more practical anyway. Then the ivars of the intermediary could be bound to various attributes, if needed. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Still unable to work out mouse position
On Nov 28, 2008, at 11:23 PM, [EMAIL PROTECTED] wrote: From: "Christian Graus" <[EMAIL PROTECTED]> Subject: Still unable to work out mouse position To: cocoa-dev@lists.apple.com Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=ISO-8859-1 Thanks to the person who answered yesterday, but I am no closer to a solution. I have an NSTableView, and it contains NSTextAttachmentCell rows. There's only one column in the table view. Basically, when a user clicks on a row, I am getting the shouldSelectRow event, which gives me a row index. I need to know if the user clicked on the icon which is in the first 16 pixels of the row. To do this, I want to either find out the mouse position in general then normalise it to the control, or I want to capture mouse movement ( without any clicks ) and record it as I go, so I know when I click, what part of the cell was clicked on. I have found there's an event on a cell that would tell me the mouse position on a click, but I can't work out how to get the event, do I need to subclass NSTextAttachment and NSTextAttachmentCell to make my cell a new type that also tracks the mouse ? I get that impression from my reading, but surely I can just subscribe to an event ? If I could just ask for the mouse position on screen, and normalise it to my table view, that would solve all my issues. Thanks christian Christian, you might consider just adding a column that contains NSButtonCell for each row. With this , it will be a LOT easier to know that what you want users to click on was clicked on. This way, all you need to do is work on the appearance and not invent any wheels. (just put new hubcaps on the wheels) If all you need to know is if a button is clicked, use a button. In IB, drag and drop your image on the buttoncell and you're done, other than setting up notifications, actions or delegation. If you really, really need a button of a specific shape and hitmask, subclass NSButtonCell. (for this you'll want to read up on NSControl and NSButton and test subclassing those first) You don't need horizontal lines on the NSTableView, because you seem to want the rows to be seamless. You can still track the mouse location within any NSRect (within a cell's rect relative to the column's rect) but you're going to have to also keep track of the visible area if the view is resized and scrollable. Depending on what you're trying to do, and if you feel like bothering with it, you may also want to consider NSMatrix, but it's a PITA. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Targetting Tiger
Your best bet is to purchase a used Mac that can run Tiger and use it for test builds. There is a huge installed userbase of Tiger still, remember it has been the longest single incarnation of OS X. (as a result of this long life of Tiger, there are lots of affordable used macs that can do the work. An iBook G4 or even a dual-processor G4 PowerMac, or a G5 iMac would be totally affordable and reasonable options that would handle it well.) You second best bet, install Xcode 2.5 on Leopard. This will be very near to the same as what can actually run on Tiger and will help you be sure that you're developing using Nibs and items that can compile on Tiger. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Auto Install Login Item
Please don't do that without asking users first. To do so would be Microsoftian iPhoneから送信 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Checking whether a file is a genuine PDF file
Google magic number This is unix and there is a ver nifty tool for such things. Ultimately u just have to ask yourself how you will handle files that seem wrong. You could also ask yourself how you would handle an unreasonably large PDF file... Then u can ask yourself if it is really necessary... It is entirely easy to create a PDF with nothing in it or with egregious amounts of stuff in it that no app could read well yet is a valid PDF Weigh carefully how far down the rabbit hole you need to go. "if it needs to be military-secure, why is PDF being used at all?" That sort of thing Sent from my iPhone On 2009/10/05, at 20:38, cocoa-dev-requ...@lists.apple.com wrote: Re: Checking whether a file is a genuine PDF file ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Language based scanning
Language based scanning To: "cocoa-dev@lists.apple.com" Message-ID: <21331617-f39c-4f3b-8f4b-795be101a...@gmail.com> Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Hi, Is there is a way to figure out the occurance of Arabic chars so the label's alignment would be set accordingly (right to left)? Part of the localization process in Cocoa is to create your localized nib/xib files. This includes adjusting interface elements and layout accordingly so that it makes sense for different languages/cultures. Even some ready-made interface elements don't think left-to-right... so you may want to customize things appropriately. It all depends on how seriously you take given locale as a market for an app. As much as people sometimes think they want easy, scriptable, automated localization of the UI, it just doesn't work that way. You SHOULD hand-tool the UI for all locales. Do it like you're building something for your own children. When your users don't have to think, and even better, when they say to themselves, "oh!? That's clever, subtle, thoughtful!" then you have done a wonderful job. In the words of Apple: Surprise and Delight. This is the Mac OS, and the user experience is paramount unless it is a command line tool... (but even then...) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Textured sheet with tabview
Don't know if I did something wrong or this is a bug. [Leopard + Xcode 3.1.3] I thought I would make a (modal) sheet textured because it provided a nice contrast with its non-textured parent window. The sheet contains one Please review the HIG (human interface guidelines) in the docs. This is a terrible design idea or apple would be doing it. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: WebView in a layer view hierarchy - not working on Snow Leopard
Pleases do not encourage use or attempted use of private functions and methods. This is bad practice. Encouraging others to do so is irresponsible and unethical. If you worked for me, you would stand a very large chance to lose your job. It is also not permitted to discuss private API on this list iPhoneから送信 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Create an NSCharacterSet constant
Hi All, Is it possible to create an NSCharacterSet constant? Attempting to do so with the methods for creating an NSCharacterSet naturally fails to compile with "initializer element is not constant" I would ideally like to be able to do this. Is it best just to declare a global constant string, then initialize an NSCharacterSet during app initialization? It certainly seems that is the only real option. Am I missing something? If I am correct in what I am seeing, would there not be a valid use case for this as an extension of NSCharacterSet? (BTW, thanks GCC for the less than clear error message which should say "you cannot run functions or methods in a global initializer" or something better.) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Create an NSCharacterSet constant
On Nov 1, 2009, at 11:32 PM, Graham Cox wrote: On 02/11/2009, at 4:19 PM, John Joyce wrote: Is it possible to create an NSCharacterSet constant? Attempting to do so with the methods for creating an NSCharacterSet naturally fails to compile with "initializer element is not constant" I would ideally like to be able to do this. Is it best just to declare a global constant string, then initialize an NSCharacterSet during app initialization? It certainly seems that is the only real option. Am I missing something? If I am correct in what I am seeing, would there not be a valid use case for this as an extension of NSCharacterSet? You can't create any non-scalar constant (except nil) using a static initializer. However, what you want to do is super-easy, and yes, it's a case for an extension to NSCharacterSet. Just add a class method as a category: @interface NSCharacterSet (MyCharacterSetConstant) + (NSCharacterSet*) theConstantCharacterSet; @end @implementation NSCharacterSet (MyCharacterSetConstant) + (NSCharacterSet*) theConstantCharacterSet { static NSCharacterSet* s_tccs = nil; if( s_tccs == nil ) s_tccs = [[self characterSetWithCharactersInString:@"..."] retain]; return s_tccs; } @end --Graham Wow, you all responded wonderfully and super fast! I had accidentally sent it to the list hours ago from the wrong email, so it was naturally rejected, then I just now sent this. Thanks to everyone, when I get a block of time I'll dive into each approach and see how they all feel. Anyway, I digress... Category, yeah, that's totally one way I thought about, but I was thinking more of an enhancement request in Radar. I figured the nature of it inheriting from NSObject implies there are some kind of optimizations under the hood (otherwise we'd just use NSString and NSScanner right?). Seems like a useful one considering the characterSetWithCharactersInString: method. Even if it were some sort of singleton class. Particularly useful in input validation routines (things like highly structured serial numbers and other identifiers, etc...) If there is consensus from multiple people on an enhancement request and the functionality and justification for it, I'll be happy to file it. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Create an NSCharacterSet constant
On Nov 2, 2009, at 12:04 AM, Graham Cox wrote: On 02/11/2009, at 4:50 PM, John Joyce wrote: Category, yeah, that's totally one way I thought about, but I was thinking more of an enhancement request in Radar. I figured the nature of it inheriting from NSObject implies there are some kind of optimizations under the hood (otherwise we'd just use NSString and NSScanner right?). Seems like a useful one considering the characterSetWithCharactersInString: method. Even if it were some sort of singleton class. Particularly useful in input validation routines (things like highly structured serial numbers and other identifiers, etc...) If there is consensus from multiple people on an enhancement request and the functionality and justification for it, I'll be happy to file it. What is your proposed character set going to contain? Is it of ultra- widespread utility? Otherwise, this is what categories are for - to add enhancements yourself in a few moments instead of waiting (possibly years) for Apple to do it for you. I don't really see that there is a case here for a radar enhancement request, but it would depend on what you have in mind. As for optimisations, I don't quite follow your argument - NSCharacterSet is not equivalent to NScanner + NSString, though it sometimes will get used with those classes. I expect the common built-in "constant" sets are there because they are of very widespread utility - e.g. stripping whitespace, but are probably not using much in the way of magic optimisations. --Graham Indeed this is the point of Categories. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Create an NSCharacterSet constant
On Nov 1, 2009, at 11:59 PM, Kyle Sluder wrote: On Sun, Nov 1, 2009 at 9:50 PM, John Joyce wrote: Category, yeah, that's totally one way I thought about, but I was thinking more of an enhancement request in Radar. I figured the nature of it inheriting from NSObject implies there are some kind of optimizations under the hood (otherwise we'd just use NSString and NSScanner right?). An NSCharacterSet embodies the concept of "a set of characters." An NSString and NSScanner pair embodies the concept of "how I'm gonna find some characters in a string." The first is a value type, the second an implementation detail. NSCharacterSets are also useful for other things than just finding them in a string or other stream of data. Seems like a useful one considering the characterSetWithCharactersInString: method. Even if it were some sort of singleton class. Particularly useful in input validation routines (things like highly structured serial numbers and other identifiers, etc...) I'm confused about what enhancement could be made that would not be highly specific to your application. --Kyle Sluder Not my application per se, but for more applications. I see it as a useful thing to have predefined character sets that don't need to be managed. It's still just as simple to create them, but it sure would be nifty to not have to and to manage them in a constants file. At the very least, I will probably submit a radar on adding locale- specific standard sets. The standard set is woefully Latin-centric. Many languages do not use whitespace the same way (generally as word boundaries). Many languages also do not have the concept of capitalization. Japanese is one in which I happen to work. There would be a multitude of sets that would make sense in Japanese for a multitude of super common purposes. I know, some of this leads to things like tokenization. Point being, if we look beyond English and Western Europe, and consider how much of programming is pushing text around, it certainly seems like a logical expansion that would be of benefit to a lot of people. Maybe it's just me, not trying to hog the list. If anybody has some good sets for consideration, I'll be happy to include them when I create that radar. Beyond that, I'd be willing to produce and host open source sets for use, if anybody wants to contribute them (( send them off list )). ( anything locale-specific should ideally include localized documentation as well ) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Download Alert -- Quarantine information removal
On Dec 1, 2009, at 11:03 PM, cocoa-dev-requ...@lists.apple.com wrote: > Hi all, > > If I download a DMG from web and launch an (XYZ) application from it, then > system will show an alert saying „ XYZ is an application which was > downloaded from the Internet. Are you sure you want to open it?‰ PFA sample > screen shot for this. > > Help is saying that if you downloaded from un-trusted source then this error > will come. I tried codesign-ing and downloading from Œ*https://*‚ server but > still getting this alert. > > When did some analysis I found that file system keeps Quarantine information > in the extended attributes along with the files and shows this alert. > xattr -d com.apple.quarantine will remove this. > > But I am writing an installer and I am coping files from the downloaded dmg > to the system and system is keeping this info for all the files I copy. > Eventually I am getting this alert. I tried different methods to copy files > but no success. > > I believe apple should provide some method through which I can copy files > without copying Quarantine information. > > The option left for me is to execute the above command for all the files to > be copied. But it leads to performance degradation. > > Any suggestions please? > > Thanks, > > Regards, > -Sra1 Please do not do this. Please read the documentation on why this is there and what is expected behavior. Code Signing does not prevent this. Even Apple software that is downloaded internally triggers the quarantine message to users on first launch of that software. This is intended to be there. If you are developing software for an enterprise ( I use the word loosely) deployment, you'd do better to examine other ways to deploy software. In such cases, you should consider building an image consisting of preconfigured system software and apps on OS X Server and deploying that to client 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: Un-mounting of first DMG is taking 15secs
On Dec 1, 2009, at 11:03 PM, cocoa-dev-requ...@lists.apple.com wrote: > Hi all, > > In my application I need to mount and un-mount DMGs, but in one specific > workflow un-mounting of first DMG is taking 15secs of time. > > I am using Œhdiutil‚ command and NSTask with the following options ... > Mounting: > hdiutil attach -noverify ˆnoautoopen ˆnobrowse ˆnoautofsck > ˆreadonly ˆquiet -mountpoint > Unmounting: > hdiutil detach -quiet > > I am using NSTask, waitUntilExit method for every mount and un-mount. As I > want mounting, un-mounting to be sync operations. > > Only first un-mounting is taking 15secs time, if I won‚t wait for > un-mounting and and try mounting the second DMG then the second DMG mount is > also taking 15secs time. It means either unmounting of first dmg or mounting > of second dmg is taking time. The same code is not taking time in many other > workflows. > > In the specific workflow which is taking time, my application is being > launched by another root privileged process. > > Do any one faced this type of issue ? Or any suggestions ? > > Thanks and Regards, > -Sra1 Without posting code or more detail on these "workflows" as well as what you have tried, it is unlikely you will get much of a response. Based on "sometimes it takes a long time" then that would indicate something is still happening. If a process is running from the dmg, then it cannot unmount until that process ends. Example: if you launch an app that is inside of a dmg, or on another volume external to the boot volume, you cannot unmount that volume until that app is terminated in some fashion. You may want to try monitoring the processes running (top is a good unix tool for this) or fseventer ... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Download Alert -- Quarantine information removal
Doh! Sleepiness! Sry Sent from my iPhone On Dec 2, 2009, at 12:17 AM, Andrew Farmer wrote: On 1 Dec 2009, at 22:04, John Joyce wrote: Please do not do this. Please read the documentation on why this is there and what is expected behavior. Code Signing does not prevent this. Even Apple software that is downloaded internally triggers the quarantine message to users on first launch of that software. No, I think you're conflating two different warnings here - there's one warning for "first time you've opened X", and a separate warning for "first launch of quarantined app". The former only shows up once, but the latter will show up every launch if you don't have permissions to clear the quarantined attribute -- which is why it's important to clear that up in an automated install. :) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Checking for hackintosh
Does anybody have a means or a tool for checking for hackintoshes? I really don't approve of such things and would like to leave clever messages on my own software if it is run on a hackintosh. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Cocoa / AppleScript Folder Action
I know I can do awkward things with AppleScript and Folder Action scripts, but is there a strictly Cocoa/Objective-C way to do something like Folder Action scripts short of a daemon? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Controlling line-breaking in a text view
You might consider subclassing, but you might also want to read a lot more stuff first. Cocoa (and Carbon) text facilities are pretty deep. There is nothing about a bug in the text system. It is just that the text handling in Cocoa is very sophisticated and is designed to handle things depending on language and locale and function. Where and how to break words and what is a word can be a very complex subject, even just in one language. Even in page layout for print media, some things are hand-tooled. For your purposes, you might want something that recognizes a path or URL and formats it. Text Layout Programming Guide file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/TextLayout/TextLayout.html NSTypesetter Class file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTypesetter_Class/Reference/Reference.html ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Subclassing NSTextView
In Xcode 3.1, what is the minimum necessary to create a useable subclass of NSTextView ? (before adding/overriding methods) Additionally, in IB, is there any effective difference from using an NSTextView, selecting the text view within its scroll view and changing its class (in the inspector) to that of the subclass (say, MyTextView, for example) and selecting a custom view, setting its class to MyTextView and then selecting Layout > Embed Objects In > Scroll View ? I'm aware of the usual caveats leaning toward delegation and notification, but I'd like to do this as an exercise to better understand the capabilities of subclassing NSTextView. Even a link to a tutorial/walk through would be nice. I've already read Subclassing NSTextView in the developer docs, but it does not quite show me everything, it seems. In the feeble attempts I've made, when running the app, the custom text view places vertical lines where glyphs would be, and it does so starting at wherever in the view you initially click... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
RE: Subclassing NSTextView
Ooops, nevermind!! I answered my own question. When adding the class file to the project, start with the NSView subclass template, then change it to subclass NSTextView in the .h and in the .m either call [super drawRect:rect]; or comment out or delete the drawRect method all together. That was too stupidly easy to be obvious. Too bad there is not an option for more subclass templates right in the GUI ... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Using Flex/Lex in a Cocoa project
Right now, I'm toying with using Flex/Lex in a Cocoa project. Unfortunately, I don't see a reliable or easy way to handle NSStrings correctly all the time with Flex. Does anybody have any suggestions for such text handling and reliable unicode aware regexes? I'm seriously not interested in implementing such details in C with Flex. Flex is fast and cool for that, but if it's going to be stupidly difficult to use reliably with other languages on a mac, it's not a good idea for me. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Cocoa-dev Digest, Vol 5, Issue 1470
On Fri, Aug 15, 2008 at 10:53 PM, John Joyce <[EMAIL PROTECTED]> wrote: Right now, I'm toying with using Flex/Lex in a Cocoa project. Unfortunately, I don't see a reliable or easy way to handle NSStrings correctly all the time with Flex. Does anybody have any suggestions for such text handling and reliable unicode aware regexes? I'm seriously not interested in implementing such details in C with Flex. Flex is fast and cool for that, but if it's going to be stupidly difficult to use reliably with other languages on a mac, it's not a good idea for me. Depending on exactly what you need, unicode awareness can be fairly straightforward. Commonly, unicode in regexes is only needed to pass through undifferentiated blobs of text, with ASCII delimiters. For example, imagine parsing a CSV file which potentially has unicode text inside the quotes. For this case, you can convert the file to UTF-8, and then constructs like . will accept them. All non-ASCII characters in UTF-8 are represented as bytes 128-255, so if you just pass those through then you'll be fine. But be aware of some potential problem areas: - Each non-ASCII character will be more than one byte, and flex will think of it as more than one character. Write your regexes accordingly. In particular, avoid length limits on runs of arbitrary characters, and avoid using non-ASCII characters directly in your regex. - It's very difficult to split UTF-8 strings correctly. If you encounter a run of non-ASCII characters, ensure that you follow that run through the end, until you get back to ASCII. Don't have a regex that stops in the middle of it and then expects your code to be able to do something useful with it. - If you need to do something with non-ASCII characters besides read them in one side and write them out the other, for example doing something special with all accented characters, then Flex is probably not the right answer. Besides this it ought to be pretty straightforward. Since Flex just passes your code straight through to the compiler, you can write Objective-C in the actions (as long as you compile the result as Objective-C, of course!), convert the text from UTF-8 back to an NSString, and take things from there. Mike Thanks to all. Mike, your answer especially set it on the right path that Flex is not going to do what I would like to do, at least not without a lot of work that might be silly. Certainly, I could extract ranges of strings that are within the ranges of ASCII and apply rules to them and then lump other stuff into a separate group, but I'd like to have more control. If I were willing to just do ASCII, it would be a wonderful thing, since Flex is so fast. I understand well enough how difficult it can be to establish rules for unicode strings when there are a lot of semantics possible depending on the language. In my case, I am mainly interested in working with Japanese text, which does have difficulty due to a general lack of white space to rely on, but beyond that not so much more than a large character set. I want to be able to use Japanese strings as tokens throughout something. I seriously wonder how sophisticated syntax highlighting in Xcode really is... it does handle things quite well! As cool and wonderful as Flex is, it just isn't going to be reliable for what I want to do. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Using Flex/Lex in a Cocoa project
On Aug 18, 2008, at 7:01 PM, [EMAIL PROTECTED] wrote: to avoid the splitting problem (c < 128) ? "%c" : "\\u%04x", c); Not quite sure what this is doing. I see it's checking for ASCII range if ( c < 128 ) The conditional is obvious, but what's the other doing exactly? returning a char if it is ASCII, it seems, and then some sort of escaped version if it is beyond ASCII range...? Particularly there, I'm not sure what that results in. Basically, I only need to do anything based on characters that are in ASCII now, but I'd like to allow other ranges in the text files without worry. Browsing around, I've seen where basically, everyone is hoping somebody else will modernize lex and yacc with a clever algorithm that reduces the overhead. Personally, I think that in many cases, this should be no problem with the speed and capability of contemporary computers, but it could still be a drag. I have been looking at simply building an NSString of the same length with ranges of non-ASCII subbed out with some other character, just to do the lexing, then apply the results of the lex to the original NSString. For speed, it may even make sense to simply have two NSStrings going, one that is the real thing, the other that auto-substitutes anything non-ASCII. For this, my question to all is, what ASCII character would be good for the substitution without messing up the regexes? I'm considering some the unused control characters in the lower ranges, but I'm a little scared to see what will happen... Any suggestions on this idea? Cheers, JJ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Using Flex/Lex in a Cocoa project
On Aug 18, 2008, at 8:12 PM, Ricky Sharp wrote: On Aug 18, 2008, at 8:01 PM, John Joyce wrote: On Aug 18, 2008, at 7:01 PM, [EMAIL PROTECTED] wrote: to avoid the splitting problem (c < 128) ? "%c" : "\\u%04x", c); Not quite sure what this is doing. I see it's checking for ASCII range if ( c < 128 ) The conditional is obvious, but what's the other doing exactly? returning a char if it is ASCII, it seems, and then some sort of escaped version if it is beyond ASCII range...? Particularly there, I'm not sure what that results in. That was my question too. If operating on a UTF-8 stream, this is going to do all kinds of weird stuff. For example, for the input string LATIN SMALL LETTER E WITH ACUTE (U +00E9), you'll have a UTF-8 byte sequence of 0xC3 0xA9. But the above will turn that UTF-8 sequence of bytes into this string: "\u00C3\u00A9" This string now represents: LATIN CAPITAL LETTER A WITH TILDE (U+00C3) followed by COPYRIGHT SIGN (U+00A9) ___ Ricky A. Sharp mailto:[EMAIL PROTECTED] I wonder if it wouldn't make sense to just start trying to build some new form of flex in Objective-C... so that it uses NSString and NSMutable string ? I'm looking at the Flex source code now... in true GNU fashion, it is well documented, but somewhat terse C... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Using Flex/Lex in a Cocoa project
On Aug 18, 2008, at 9:23 PM, Graham Cox wrote: On 19 Aug 2008, at 11:53 am, John Joyce wrote: I wonder if it wouldn't make sense to just start trying to build some new form of flex in Objective-C... so that it uses NSString and NSMutable string ? I'm looking at the Flex source code now... in true GNU fashion, it is well documented, but somewhat terse C... And you know about NSScanner, right? Graham Yes. I'm looking at it. I'm also looking at how Smultron uses RegexKit. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Core Data Bindings with Table View
I'm having a little difficulty making sense of the right bindings here. I'm using Core Data. No problem, simple modeling. Entity: App Attribute: name Relationship: relatedFile (to many) Entity: File Attribute: path Relationship: relatedApp (to one) NSArrayControllers: Apps, Files Both are bound to the AppDelegate.managedObjectContext and are set to their respective Entities; App and File In my NIB/XIB, I've got two tableViews. One lists the Apps. No problem binding its single table column to Apps.arrangedObjects.name in the inspector. Can add and remove fine. The other tableView is intended to list files related (if any) to the app selected in the Apps TableView. The Files TableView is also a single column. I cannot figure out how to properly bind this thing. I'm sure I'm missing something simple and obvious here... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Core Data Bindings with Table View
Thanks Tim! That did it. It makes sense, but it definitely wasn't the most intuitive. I kept trying to set a key path in the tableView or column bindings, which could logically make sense. I must say that core data itself is easy, conceptually, having worked with Rails and ActiveRecord. It's Bindings in particular that always seems to stump me. Conceptually, Bindings are quite simple. Practically, quite difficult if you just don't know what object you should be binding to where! Quite the rabbit hole. I bet I'm not alone in that I would pay well if somebody would publish a Bindings cookbook or just a really lengthy book of tutorials and various exercises using Bindings in many ways. The thing that worries me most about Bindings though, is the same thing that worries me about Objective-C 2.0 Properties; neither one has great debugging options that I can see... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
App names
When dealing with applications (application bundles) by name or path, in Cocoa, when does it make a difference whether you use App Name.app example: Front Row.app or: /Applications/Front Row.app versus App Name example: Front Row or: /Applications/Front Row This seems to be pretty important, and I'm curious when and to what degree I should be cautious about the naming used in code. At this time I am mainly concerned about Apple apps themselves that should normally be in the system. Subsequently, is there any difference concerning 10.3 / 10.4 / 10.5 ? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: App names
On Aug 31, 2008, at 4:51 PM, [EMAIL PROTECTED] wrote: If you're dealing with a file path, then of you of course need to specify the extension -- it's part of the file name. You've always had to, and always will have to. -- Seth Willits AppleScript certainly doesn't care about extensions on application bundles... Of course that seems to be due to the syntax... tell application Finder ... Which is why I am inquiring. There are certainly points in the Mac OS that are designed to be more human. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Accessing SDL Frameworks Bundled with Leopard...
Does anybody know any official or proper way to link to the SDL framework that is bundled in the root library in Leopard? /Library/Frameworks/SDL.framework is surprisingly, there! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Accessing SDL Frameworks Bundled with Leopard...
Well, thanks. I guess I must have installed it at some point, but I don't recall downloading it... I wonder if it was packaged with something else... well good to know I hadn't lost my mind in thinking that it was strange that I had not seen that there before ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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 Safari Bookmarks in the code
On Sep 29, 2008, at 9:50 AM, [EMAIL PROTECTED] wrote: Subject: How to get Safari Bookmarks in the code To: [EMAIL PROTECTED], cocoa-dev@lists.apple.com Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=ISO-8859-1 Hi All, I am creating a application that needs to display Safari Bookmarks. Is there any way to get safari bookmarks. Please help me in this.. Regards, Sridhar. Lots of ways to do this. You the bookmarks plist file is specific to each user's library. That's the thing to read. You could read it using almost anything. It is a very very simple list of bookmarks. You could use applescript to export the bookmarks from safari. This yields the bookmarks in an html file. Your options are many and flexible. You might want to play with it a bit more first. It's pretty trivial data to access. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Setting Minimum and Maximum width of Toolbar items
I've noticed that in IB 3, the Minimum and Maximum width of Toolbar items does not stick. You can enter it, command+S to save and then click done, and everything reverts back to 96px wide. One can only presume this is a bug or I don't know something. Do these things need to be set programmatically or do I have some other (nice, lazy) option? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Setting Minimum and Maximum width of Toolbar items
Never mind. I have found the solution. The "Document" window in IB 3 must be in list view. In List, expand the tree of disclosure triangles from Toolbar Toolbar > Toolbar Item (name if any) With the Toolbar Item highlighted in List View, it is possible to get the sizing to stick in IB 3's Inspector palette. Incidentally, the list view is also a great way to wire things to the items in a toolbar... Sometimes it is just easy to forget about the list 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 do you use to make icons and similar?
: I believe png are really what I'm trying to make here, they seem to be recommended. PNGs are not resolution independent, although they are perfectly acceptable. Saving as a TIFF then converting it to PDF with Preview works well for me. Please excuse me if I missed something earlier in the thread, but my understanding of TIFFs (and PNGs and JPEGs) is that they're all purely raster formats. Thus, how does saving a TIFF as a PDF get you resolution independence? (At least that's what I read you to be saying.) steve It doesn't and it cannot. PDF is only a container, that happens to support vector art well, but cannot vectorize a raster image. If you properly placed some vector art into a pdf you might be able to garner some sort of resolution independence, but it's probably not worth the effort, and definitely won't look as good in most cases as well designed/optimized icons. Until displays approach something like 300dpi or higher, like print media, our eyes will be better served by icons hand-tooled for particular sizes. Your safest bet is to make use of PNG. It supports transparency. If you need something in .icns format, make use of Icon Composer. As for drawing/painting apps, don't be cheap! If you don't have skill, pay somebody to do it. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Creating Toolbar Items in IB
It is still buggy. Sometimes arrangements and sizes stick. Sometimes they don't. Use list/tree view in the "document" window of IB. This is the easy to forget about, but very useful way to be sure you're connecting outlets. Particularly, with toolbar items. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Turning off Auto Complete feature for NSTextField
On Oct 28, 2008, at 8:42 AM, [EMAIL PROTECTED] wrote: Turning off Auto Complete feature for NSTextField To: cocoa-dev@lists.apple.com Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=us-ascii Hi, I am encountering a small problem. I am using a simple NSTextField in my application. This textfield is editable. When user starts entering some text, the auto complete is by default ON, so on pressing escape key a list of suggestions is displayed. I don't want this feature. How can i turn off the auto complete feature for NSTextField. I couldn't find any option in Interface Builder or the documentation of NSTextField. Thanx Are you sure you're using NSTextField and not NSTextView? The behavior is part of NSTextView and the two are a bit different. You'll need to override some methods, so you'll want to subclass. You might be surprised how often the completion is available in apps. NSTextField does not appear to have the same methods. Oddly, both do have the Delegate method control:textView:completions:forPartialWordRange:indexOfSelectedItem: This is pretty simple to take over. You just hijack it by giving it nothing! An empty array. Of course this will still give you the system alert sound if esc is pressed to autocomplete. The normal set of completions will come from Dictionary.app so they will be locale-dependent. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Controller and NIB
Make sure you're spelling the method signature 100% correctly. I myself have made a minor typo in a method (many times, who hasn't?) and then spent the next 20 minutes or longer bashing my head looking for my mistake. Spelling counts 100% Capitalization ( my mistake has often been NIB instead of Nib ) always check the return type and argument type If any of these are wrong, but syntax is correct, the compiler will compile and run without complaint. make sure you've got -(void)awakeFromNib { // your code here, such as... NSLog(@"awake from Nib"); } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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 Oct 30, 2008, at 7:41 AM, [EMAIL PROTECTED] wrote: Date: Thu, 30 Oct 2008 10:31:03 From: Mark Allan <[EMAIL PROTECTED]> Subject: RE: Re: Static text over an image To: Brandon Walkin <[EMAIL PROTECTED]>, Andre Masse <[EMAIL PROTECTED]> Cc: Cocoa Dev Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=UTF-8 I've seen this happen *every* time in IB if the items in question are within an NSView. It was driving me crazy for a while until I figured out (completely by accident) that the order has to be reversed when you're setting up the NIB/XIB file for it to work correctly. It's a real PITA because to see and edit the text which you want, eventually, to appear on top of the image, you constantly have to select the image/text and go the Layout menu and move it back and forward as required, and then remember to move the text back behind the image before you save and rebuild your project. No, you don't have to constantly re-arrange things. It would be nice if there were some sort of "layers" in IB. However, all you need to do to edit it is change the "document" window view from Icon view to List view or Column view. You can then select exactly what you want to work with from there. As your Nib/Xib gets more complex, this is necessary. Beyond that, you may find yourself setting a lot of things in code at some point... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Targeting Tiger
On Jan 24, 2009, at 8:31 PM, cocoa-dev-requ...@lists.apple.com wrote: Not sure what you mean by "capable of running tiger". If you have a machine capable of running Leopard, it should be able to run tiger. Not true. In general, any Mac requires the latest OS available at the time it was released. So machines released after the release of Leopard usually require Leopard. Not in general. No Mac is supported to run any version of the Mac OS earlier than the version it officially shipped with. If your Mac officially shipped with 10.5.4 it is unsupported to run 10.5.3 or earlier. Period. If you do not know, and you may not, call AppleCare, provide the serial number of the Mac, they can tell you precisely which version it originally shipped with and that will be the earliest version you can reliably run on that computer. Although in some cases you may successfully boot and run some earlier version, it is unsupported, meaning it would not be a good test environment. Any Mac that runs Tiger well, will be more than adequate for most Tiger development. (exceptions would be targeting higher or lower end hardware) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Using new Cookies
If using a WebView, and loading a URL from a web site, what is the recommended way to prevent using the user's cookies set for Safari? Basically, I'd like to get cookies specifically for the user for this app and keep them distinct from Safari. Is there a particular approach that is best practice in this regard? Is it something so simple as sending a unique user agent string, or is it something else? Regards, John Joyce ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Running Cocoa applications from file servers
On Feb 25, 2009, at 12:00 PM, cocoa-dev-requ...@lists.apple.com wrote: On Wed, Feb 25, 2009 at 10:43 AM, Erik Buck wrote: Where did the fetish for installing every single application on the local hard disk come from ? Isn't it insane to have 35 installed copies of OmniGraffle using up disk space just because you have 35 licenses ? Why is MS Word on every disk instead of just the server? ... because network interruptions (especially intermittent ones) can wreak havoc on your running apps. :-) That's my main reason. -- I.S. In other words, most desktop apps are not really built for handling packet loss, which is an inevitable aspect of network apps. Most apps think they are being run from an attached storage device, but do not know that their resources may become unavailable suddenly. Imagine a simple button or graphic or plist that is only loaded when it is needed... go to load it... packets are lost during transmission... the app chokes, becomes unresponsive and user data is lost because the app does not know how to handle this predicament. If an app is designed for being run from a server, fine. If not, possibly not fine. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Converting String Representations at Runtime
Is there an easy way to take input (user or file based) at runtime and convert unicode strings such as \u8D64 (UTF8 character) or a whole series of these to the human-readable characters they represent? I imagine I should be using NSScanner, but is there not some simple function or method to lookup and return the character as it should be represented? Happy to RTFM, just need a pointer to the docs I should be looking at. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Using CFStringTransform with Attributed strings or runs, maintaining the styling of the Attributes in transformed results.
Currently, I'm using CFStringTransform to convert Java-based strings files (JBoss .properties files) to something human-readable for verification. Works brilliantly. Luckily, these files are short and this function is super fast. This enables me to naively take all the text of a file provided or copied and pasted and convert it whole in one pass. My question is, will this function handle AttributedStrings? Presumably not. Is there a lazy way to handle this ? (since this function is super good about recognizing and transforming only string ranges that it targets) or is it going to require me coming up with an equivalently clever way of determining the ranges of attribute runs to make this practical?? I can certainly do it, but I am sure if there is a CF or NS way of it, that it is already more clever than anything I would come up with. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Using CFStringTransform with Attributed strings or runs, maintaining the styling of the Attributes in transformed results.
On Apr 19, 2009, at 3:42 PM, John Joyce wrote: Currently, I'm using CFStringTransform to convert Java-based strings files (JBoss .properties files) to something human-readable for verification. Works brilliantly. Luckily, these files are short and this function is super fast. This enables me to naively take all the text of a file provided or copied and pasted and convert it whole in one pass. My question is, will this function handle AttributedStrings? Presumably not. Is there a lazy way to handle this ? (since this function is super good about recognizing and transforming only string ranges that it targets) or is it going to require me coming up with an equivalently clever way of determining the ranges of attribute runs to make this practical?? I can certainly do it, but I am sure if there is a CF or NS way of it, that it is already more clever than anything I would come up with. Oh, one more question... I didn't see it in the function documentation, but is there a way for CFStringTransform to tell me the ranges of the the transformations it has done in the returned string?! That would certainly be nifty! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Converting String Representations at Runtime
Is there an easy way to take input (user or file based) at runtime and convert unicode strings such as \u8D64 (UTF8 character) or a whole series of these to the human-readable characters they represent? I imagine I should be using NSScanner, but is there not some simple function or method to lookup and return the character as it should be represented? Happy to RTFM, just need a pointer to the docs I should be looking at. Does CFStringTransform do what you want? http://www.cocoabuilder.com/archive/message/cocoa/2007/11/6/192402 Adam, Thanks!! Sorry for the late reply, haven't been able to address this since last week. CFStringTransform does exactly what I wanted to do. It even pretty gracefully handles the whole string supplied. (no idea to how far mileage would vary with this based on supplied string size or content... maybe somebody from apple can comment on that) Oddly enough, that archived thread mentions supplying a constant that is not in the documentation as best as I could tell... perhaps the CF docs dong get as much attention as they should? I can certainly file a bug if appropriate... The only catch was I finally had to sit down and look at how to handle toll-free bridging. But thankfully that was not too bad. Mostly a matter of typecasting really. Thanks a million! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: detect option key on startup
Depending on why you want to do this, you may want/need to try different approaches with mini-test apps to see what your results are. If you test with iPhoto for example, it does load the main menu nib, but loads a different nib than the usual main window for choosing or creating an iPhoto library. This should give you some indication of what is happening. The main app is completely launched, but the decision on what main menu items are available and what nibs are loaded is made early here. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Localization strategies?
On Dec 21, 2009, at 8:18 PM, Uli Kusterer wrote: On 20.12.2009, at 21:30, Ricky Sharp wrote: Thus, I'm wondering if it would ultimately be worth it to externalize all strings from my nibs and just put everything in my single .strings file. This will clearly involve me adding tons of IBOutlet ivars just so that at runtime I can set their text with NSLocalizedString APIs. One approach to avoid the whole IBOutlet excess would be to create subclasses of the standard view classes which, when they are loaded, use their contents/title as the key and pass it to NSLocalizedString (). That way, your NIBs only contain keys, and the .strings files can hold the actual strings, including comments. Another possibility: instead of creating a bunch of subclasses and having to specify that subclass for each view you create in IB, you could write a method that recurses through all views in a window. Check each view for a "title" or "name" property (maybe "stringValue" too), and maybe use some convention like #TITLE# to indicate you want to replace that title or name with a localized string to be gotten via NSLocalizedString(). Check whether the view is a table view that displays column headers, and if so, iterate through its columns. Do similar special-casing for tab views and segmented views and anything else that needs it. This method could be in its own utility class, where it could be called by awakeFromNib. Offhand I think this is how I would do it if I wanted to take the approach of putting keys in the nib. --Andy It's best not to localize in a locale unless you are going to do it correctly! That means hand tooling the UI. Apple realized long ago that GUI elements must be localized correctly. This means far more than translation with the inevitable string length differences. This means making an interface make sense in a localized format. One size fits all only when the UI is intuitive and self explanatory. (Photobooth is an excellent example) It tends to be true that your UI could use improvement if it is overly textual. A good UI design can avoid localization being painful. This is the true shortcut in localization ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Custom NSWindow drawing
On Jan 2, 2010, at 4:43 AM, cocoa-dev-requ...@lists.apple.com wrote: Custom NSWindow drawing To: cocoa-dev@lists.apple.com Message-ID: <120d436a-24e6-4174-9858-dea4eb3ff...@gmail.com> Content-Type: text/plain; charset=us-ascii I want to draw an NSWindow that looks similar to this: http://vibealicious.com/site/apps/notify/screenshots/mainUIFull.png In that it has a typical NSWindow appearance with the bottom bar and such, but instead of a title bar at the top, I want to draw a little arrow. Is there a simple way to do this? Do I have to draw the entire window by hand (bottom bar and all) ? Or can I slightly modify the existing NSWindow layout to just draw that arrow at the top? Thanks Before attempting this, please read the HIG (Human Interface Guidelines) It is best to keep apps consistent with the mac user experience wherever possible. What u see in the picture shouldve been a menu by UI/UX conventions. That said, what you want to do is a bit involved and you would do well to google a few open source projects. A true window on os x has a titlebar which conveys very conventional user infomation and functionality. It is rare that a highly unusual UI will be more than gimmicky and truly functional + well purposed. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: What gets automatically localized?
On Jan 7, 2010, at 12:36 AM, cocoa-dev-requ...@lists.apple.com wrote: > Subject: Re: What gets automatically localized? > To: Cocoa Developers > Message-ID: > Content-Type: text/plain; charset=windows-1252 > > > On 2010 Jan 05, at 14:11, Dave DeLong wrote: > >> I'm working on localizing an application, and I've been trying to figure out >> what the runtime/OS/whatever will automatically localize for me >> (specifically referring to the standard menubar). Obviously, if I add my >> own NSMenuItems, I have to localize them myself. Some menuitems seem to be >> translated automatically (Undo, Redo, Special Characters), while others >> don't (Find, Spelling, Services). Is there any rhyme or reason to why some >> menuitems get localized without intervention and others don't? Do I, for >> example, need to manually localize "About MyApp", "MyApp Help", "Hide >> MyApp", "File" (the menu title), "Edit" (menu title), etc? > There isn't a canonical list (AFAIK). But there is one sure way to find out... create the localized nibs! Two places you must check for in the .lproj the nib/xib files themselves (or by launching the app) and Localizable.strings file ibtool will help tremendously in finding out. One BIG caveat: some words in English are the same in other locales!! Translation: there are no shortcuts to good localization. (not many anyways) (same with engineering, graphic design, etc...)___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Custom sheet question - which variable?
On Jan 10, 2010, at 2:01 PM, cocoa-dev-requ...@lists.apple.com wrote: > From: Jenny M > Subject: Custom sheet question - which variable? > To: cocoa-dev@lists.apple.com > Message-ID: > > Content-Type: text/plain; charset=ISO-8859-1 > > Hi, I have what may seem like a very stupid question about custom sheets. I > am following this Apple dev tutorial: > http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Sheets/Tasks/UsingCustomSheets.html > > and I'm looking at this piece of code here: > > if (!myCustomSheet) >//Check the myCustomSheet instance variable to make sure the custom > sheet does not already exist. >[NSBundle loadNibNamed: @"MyCustomSheet" owner: self]; > > But, I have no idea what "myCustomSheet" is referring to. I know that > "MyCustomSheet" is the separate XIB file, but of what variable type is > "myCustomSheet"? Do I need to define and connect to it in the new XIB? > > Thanks. In this case the documentation is just putting in a quick simple check to verify that the sheet is not already displayed before trying to display it. Since no variable for the sheet is passed to the method, this might seem a little strange... the docs here fail to remind you that you should declare mySheet (or whatever you want to call it) in your controller you use this in. (the docs make an assumption that you know this here, but arguably they should not. You might consider filing a bug on the documentation to clarify it)___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: MKPinAnnotationView callout behind other pins
On Jan 19, 2010, at 9:06 PM, cocoa-dev-requ...@lists.apple.com wrote: > On 20/01/2010, at 9:49 AM, Jacob Schwartz wrote: > >> Onto my question. I have an iPhone app that has pins dispersed across an >> area. When I click on a pin, the callout pops up as normal, but it is >> SOMETIMES hidden by the other pins. I cannot find an answer anywhere on why >> this would be the case, let alone why it happens to some pins but not every >> pin. I don't know how much code you would need to see so Ill let you request >> to see what you need. > > > Presumably a drawing order problem - the pop-up isn't being drawn last. More > than that, who can say? Find a reliable way to recreate it. Perhaps a set of data and specific locations. File a bug. If it's not your bug, and if u can recreate it, you can help get the bug fixed. Everyone wins.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Imitating Behavior of a Sheet Window
It might be worth considering simply loading a layer backed view. You may not need a full child window. If it is very different from a standard sheet, keep it different. Avoid confusing users. It's recommended to follow the HIG as much as possible. Sent from my iPhone ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Allow only root/admin users to execute the cocoa app
Just use parental controls on systems that non administrator users log in to. See the help menu. Sent from my iPhone On Jan 24, 2010, at 10:23 PM, cocoa-dev-requ...@lists.apple.com wrote: I want to allow my cocoa app to be only launched by root/admin users. How can i achieve this? As I think has already been mentioned, the UNIX approach is to set the application's owner as root and then make it only executable by the owner. However, Apple largely discourages programmers from developing Cocoa apps that will be run with root privileges. A better approach, if possible, is to factor out the section of code that needs to be run with root privilege (e.g., to read a protected file or open a network tap) and place that in a command line helper tool. The Cocoa app then runs with normal privileges. When the program needs to perform the privileged operation it calls that helper app (think of it as a kind of remote procedure call). Look up Apple's BetterAuthorizationSample code for how to do this. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: keyCode translation for various keyboards
On Feb 3, 2010, at 8:23 AM, cocoa-dev-requ...@lists.apple.com wrote: > Dave Carpeneto wrote: >> Hello list folk - I'm trying to print out strings representing various >> keyDown events I receive. Using OS 10.6.2. > ... >> So far the two approaches I've seen are as follows: > ... >> Approach #2: Get what you can via UCKeyTranslate, and then 'fill in >> the blanks' with a lookup table for non-alphanumeric stuff (example: >> http://inquisitivecocoa.com/2009/04/05/key-code-translator , which >> looks like it builds off a patched version of >> http://rogueamoeba.com/sources/HotKeysLib3.zip ) >> >> Prior threads by people in the know ( >> http://www.cocoabuilder.com/archive/cocoa/101991-key-codes-and-characters-in-nsevents.html >> >> ) further state that developer-created lookups are a fact of life in >> this area, but I'm reely hoping they are not ... > OK, given that even the up-to-date code snippets I can find on the > interwebs ( http://code.google.com/p/shortcutrecorder ) do the lookup > thing I'm guessing that there's no better way to go about it. Which is a > shame, as I'm still freaked out about the possibilities that > international keyboards may present. But at least I'm pretty confident > this is what everyone else is doing, so "as bad as everyone else" is > good enough I guess ;-) > > On the off chance that someone else bangs their head against this > situation here's the mapping table I've come up with, which gives pretty > unicode symbols where possible: > > // keycode mappings from http://ritter.ist.psu.edu/projects/RUI/macosx/rui.c > // unicode symbols from > https://wincent.com/wiki/Unicode_representations_of_modifier_keys > // more unicode @ > http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/KEYBOARD.TXT > > keyCodeToStringDict = [[NSDictionary alloc] initWithObjectsAndKeys: > > @"\u23CE", [NSNumber numberWithInteger: 36], // Ret > @"\u21E5", [NSNumber numberWithInteger: 48], // Tab > @"\u2423", [NSNumber numberWithInteger: 49], // Space > @"\u232B", [NSNumber numberWithInteger: 51], // <-Del > @"\u2324", [NSNumber numberWithInteger: 52], // Enter > @"\u238B", [NSNumber numberWithInteger: 53], // Esc > @"\u2327", [NSNumber numberWithInteger: 71], // Clear > @"\u2324", [NSNumber numberWithInteger: 76], // Enter > > @"\uF860F1", [NSNumber numberWithInteger:122], // F1 > @"\uF860F2", [NSNumber numberWithInteger:120], // F2 > @"\uF860F3", [NSNumber numberWithInteger: 99], // F3 > @"\uF860F4", [NSNumber numberWithInteger:118], // F4 > @"\uF860F5", [NSNumber numberWithInteger: 96], // F5 > @"\uF860F6", [NSNumber numberWithInteger: 97], // F6 > @"\uF860F7", [NSNumber numberWithInteger: 98], // F7 > @"\uF860F8", [NSNumber numberWithInteger:100], // F8 > @"\uF860F9", [NSNumber numberWithInteger:101], // F9 > @"\uF861F10",[NSNumber numberWithInteger:109], // F10 > @"\uF861F11",[NSNumber numberWithInteger:103], // F11 > @"\uF861F12",[NSNumber numberWithInteger:111], // F12 > @"\uF861F13",[NSNumber numberWithInteger:105], // F13 > @"\uF861F14",[NSNumber numberWithInteger:107], // F14 > @"\uF861F15",[NSNumber numberWithInteger:113], // F15 > @"\uF861F16",[NSNumber numberWithInteger:106], // F16 > @"\uF861F17",[NSNumber numberWithInteger: 64], // F17 > @"\uF861F18",[NSNumber numberWithInteger: 79], // F18 > @"\uF861F19",[NSNumber numberWithInteger: 80], // F19 > > @"?\u20DD", [NSNumber numberWithInteger:114], // Help > @"\u21F1", [NSNumber numberWithInteger:115], // Home > @"\u21DE", [NSNumber numberWithInteger:116], // PgUp > @"\u2326", [NSNumber numberWithInteger:117], // Del-> > @"\u21F2", [NSNumber numberWithInteger:119], // End > @"\u21DF", [NSNumber numberWithInteger:121], // PgDn > > @"\u2191", [NSNumber numberWithInteger:126], // Up > @"\u2193", [NSNumber numberWithInteger:125], // Down > @"\u2190", [NSNumber numberWithInteger:123], // Left > @"\u2192", [NSNumber numberWithInteger:124], // Right > nil]; >> >> Questions: >> >> 1) Is there a programmatic method to get strings like this (I'm >> guessing not) >> >> 2) Is a F1 key the same on all keyboards (if so then my worries >> about the lookup table are a non-issue) >> >> 3) Are there any keys typical in other places that don't exist on a >> 'standard' North American keyboard ? (if so heaven help me) Yes. There are. Japanese Keyboards will have a couple of keys for specific input switching. You will find frequently that the result of a key press plus a modifier key or modifier keys will produce totally different results in many locales. The question arises, what are you trying to accomplish?? Most things these days would look at what the USB device sends. All mac keyboards, even built in ones are on a USB bus. They do also emit "Mac Key Codes" but the layout of keyboards are different accross different models even just in the USA. example: black macbook F keys and their system control functionality. External keyboards usually do not have Fn key.