Re: [iPhone] get iPhone's IP address...
On Sun, Jul 19, 2009 at 10:50 PM, James Linjamesclin...@gmail.com wrote: Hi all, I found this code snipet that's supposed to return the iPhone's IP address. I am wondering if anyone can confirm the method for me. As i am told that this method works in an actual iPhone and not on the simulator. But i won't have an iPhone until Aug 9th All i am getting in the simulator is something like : fe80::21e:52ff:fec6:b7401.618407e-303n1 I am wondering if anyone can confirm the method works (ie, returns an actual ip address) on an actual iPhone for me IPv6 addresses *are* actual addresses. The real question is what you need this IP address for. Macs (and iPhones) have many IP addresses, so asking for the machine's one address is the wrong question to ask. The code: Also, using NSHost in this manner can hang your code for a long time as you wait for responses from DNS servers. Please make sure that you do not ever use NSHost from the main thread of your application. -- Clark S. Cox III clarkc...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] get iPhone's IP address...
Does the iPhone have NSURLConnection? If so, you can just point that to www.whatismyip.com or a similar site, and just parse the information. On Mon, Jul 20, 2009 at 3:11 PM, Clark Cox clarkc...@gmail.com wrote: On Sun, Jul 19, 2009 at 10:50 PM, James Linjamesclin...@gmail.com wrote: Hi all, I found this code snipet that's supposed to return the iPhone's IP address. I am wondering if anyone can confirm the method for me. As i am told that this method works in an actual iPhone and not on the simulator. But i won't have an iPhone until Aug 9th All i am getting in the simulator is something like : fe80::21e:52ff:fec6:b7401.618407e-303n1 I am wondering if anyone can confirm the method works (ie, returns an actual ip address) on an actual iPhone for me IPv6 addresses *are* actual addresses. The real question is what you need this IP address for. Macs (and iPhones) have many IP addresses, so asking for the machine's one address is the wrong question to ask. The code: Also, using NSHost in this manner can hang your code for a long time as you wait for responses from DNS servers. Please make sure that you do not ever use NSHost from the main thread of your application. -- Clark S. Cox III clarkc...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/kthemank%40gmail.com This email sent to kthem...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] get iPhone's IP address...
On Jul 19, 2009, at 11:36 PM, KK kthem...@gmail.com wrote: Does the iPhone have NSURLConnection? If so, you can just point that to www.whatismyip.com or a similar site, and just parse the information. This is ridiculous. Send an HTTP request to an unreliable third party and parse the unwarranted contents of the HTML response, which may be incorrect? As opposed to accessing the information locally accessible? --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] get iPhone's IP address...
On Jul 19, 2009, at 10:50 PM, James Lin wrote: - (NSString*) getNetAddr { char iphone_ip[255]; strcpy(iphone_ip,127.0.0.1); // if everything fails NSHost *myhost =[NSHost currentHost]; //NSHost *myhost = [[NSHost alloc] init]; if (myhost) { NSLog(@myhost exits); NSString *ad = [myhost address]; if (ad) strcpy(iphone_ip, [ad cStringUsingEncoding: NSISOLatin1StringEncoding]); } return [NSString stringWithFormat:@%s, iphone_ip]; } And just to pile on, there's no reason why you should be converting an NSString to a char* and back. That's just a waste of effort. - jp ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[iPhone] UITableView cell display bugs ?
Hello, I'm trying to reuse (with some modifications) UITableViewCellStyleSubtitle cells, which have two left-aligned labels. I want to have both labels and add a right-aligned text field. All three views must be as wide as roughly half the available content view width. It should be a trivial task: just add the text field to the cell's content view, and resize all frames. The problem is that the detail text label is stubbornly obscuring the text field, even after being resized and sent to the back. (see attached picture) I realize that any frame adjustments must be done in -tableView: willDisplayCell: forRowAtIndexPath: rather than in the method that creates/reuses cells, but I wasn't expecting the order of content view subviews to change between those two methods. I verified that bringing the text field to the front in -tableView: cellForRowAtIndexPath: has no effect because the detail text label is brought to the front between that method and willDisplayCell. Maybe there is a reason for that, but I don't see it. But there's more... In the willDisplayCell method, I resize the text field and both labels, bring the text field to the front, and even send the detail text label to the back. I know that all that is done correctly, because on exit from -tableView: willDisplayCell: forRowAtIndexPath: the cell's content view's subviews array is: cell.contentView.subviews on exit from willDisplayCell: ( UILabel: 0xd36770; frame = (11 24; 135 18); text = 'Detail Label Detail Label...'; clipsToBounds = YES; userInteractionEnabled = NO; layer = CALayer: 0xd36160, UILabel: 0xd35de0; frame = (11 2; 135 22); text = 'Text Label Text Label Tex...'; clipsToBounds = YES; userInteractionEnabled = NO; layer = CALayer: 0xd360b0, UITextField: 0xd30220; frame = (155 10; 135 23); text = 'Text Field Text Field Tex...'; clipsToBounds = YES; opaque = NO; autoresize = LM; tag = 1; layer = CALayer: 0xd30680 ) Note how all the frame rectangles are correctly set and note also that the text field is above both labels, in the subview order. Yet, the cell displays as in the picture: both labels have the correct size but display as if they extended across the entire content view. Moreover, the detail text label refuses to be displayed in the back, even though it *is* in the back by the time the willDisplayCell method exits. Given how common something like this must be (reusing standard cells, with frame changes) and how fundamentally important the view hierarchy is, I'm inclined to think that the behavior I'm seeing isn't a bug but, rather, the result of something trivial that I'm missing. Yet, I can't see anything wrong with my code, so I'd appreciate if someone looked at the sample project I created, which can be downloaded from http://www.restlessbrain.com/cocoadev/UITableView_cell_display_bug.zip To summarize, there are 3 strange behaviors that I'm seeing: a. the subview order for the subviews of the cell's content view changes between exiting -tableView: cellForRowAtIndexPath: and entering -tableView: willDisplayCell: forRowAtIndexPath: b. the label frame rectangles are resized but the labels display as if the frames had not been changed. c. setting a specific subview order has no effect on how the labels are displayed. If I'm not missing anything obvious, I'll file a bug report. Thanks in advance. inline: Picture 1.png ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] get iPhone's IP address...
On Jul 19, 2009, at 11:51 PM, Kyle Sluder wrote: On Jul 19, 2009, at 11:36 PM, KK kthem...@gmail.com wrote: Does the iPhone have NSURLConnection? If so, you can just point that to www.whatismyip.com or a similar site, and just parse the information. This is ridiculous. Send an HTTP request to an unreliable third party and parse the unwarranted contents of the HTML response, which may be incorrect? As opposed to accessing the information locally accessible? It's only ridiculous if the information is indeed locally accessible. It really depends on why the OP wants the IP address in the first place, which we don't actually have any information about right now. It's unusual for an application to even need to know its own IP address, and others have already pointed out a variety of problems with the idea. It's entirely possible that the OP is mistaken about even needing this information. But, let's assume for the sake of discussion that he's not mistaken and that he really does need it. If you are connected behind a NAT router, proxy server, etc. and need to know what your _public_ Internet address is, sometimes the only way to do it is to ask someone else (e.g. you won't always have UPnP or similar protocols to rely on). There's a reason www.whatismyip.com and web sites like it exist. I'm not suggesting that exact web site is the best way to find out the IP address needed, but the idea isn't necessarily as ridiculous as one might think. Pete ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How to schedule an application
hi, I want to schedule my application on a specified time. When the application is not running , the application should open on the specified time and process the scheduled task . If the application is running , the scheduled task should be processed within the application [without opening in a new application]. I had tried using a plist file and launchd to do it, but it always opens in a new application. Is this can be done using applescript ? thank you in advance. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
I need a milder application badge
I have cause to display something like an application badge on the docktile of my app, but the alarums-and-excursions feel of the standard bright red badge with zigzag edges is a bit too strident for what I have in mind. Can anyone point me at a scrap of code that would give me the functionality of NSDockTile:setShowsApplicationBadge: and NSDockTile:setBadgeLabel:, but would let me control the color and perhaps the shape of the badge? Or is there a different approach that I might consider? I don't need to change the badge color and shape at run-time; I would be perfectly happy to have them hard-coded into the source for whatever class or category I end up using. I *do* need run-time control over the text of the label. Thanks. -- Jay Reynolds Freeman - jay_reynolds_free...@mac.com http://web.mac.com/jay_reynolds_freeman (personal web site) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to schedule an application
On 2009 Jul 20, at 02:06, rethish wrote: I had tried using a plist file and launchd to do it, but it always opens in a new application. Instead of launching your application directly, you need to have launchd launch a little process of some kind which will do what you want. Is this can be done using applescript ? Actually, that might work. An AppleScript such as tell application MyApp ...[do what I want]... end tell will not launch a new instance of MyApp if MyApp is already running. But your app has to be scriptable -- the do what I want part If so, the little process of some kind could be an AppleScript application bundle. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: I need a milder application badge
You'll need to draw the custom content yourself by using -[NSDockTile setContentView:] On 20 Jul 2009, at 10:33, Jay Reynolds Freeman wrote: I have cause to display something like an application badge on the docktile of my app, but the alarums-and-excursions feel of the standard bright red badge with zigzag edges is a bit too strident for what I have in mind. Can anyone point me at a scrap of code that would give me the functionality of NSDockTile:setShowsApplicationBadge: and NSDockTile:setBadgeLabel:, but would let me control the color and perhaps the shape of the badge? Or is there a different approach that I might consider? I don't need to change the badge color and shape at run-time; I would be perfectly happy to have them hard-coded into the source for whatever class or category I end up using. I *do* need run-time control over the text of the label. Thanks. -- Jay Reynolds Freeman - jay_reynolds_free...@mac.com http://web.mac.com/jay_reynolds_freeman (personal web site) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] UITableView cell display bugs ?
From what you've said below, you probably should be creating a custom cell type based on UITableViewCellStyleSubtitle and add the third label to your class. At least in NSTableView (I haven't yet played with the iPhone), a cell class determines what is drawn at a particular row/column location. Right now it sounds like you're fighting UITableView rather than working with it. On Jul 20, 2009, at 1:35 AM, WT wrote: I'm trying to reuse (with some modifications) UITableViewCellStyleSubtitle cells, which have two left-aligned labels. I want to have both labels and add a right-aligned text field. All three views must be as wide as roughly half the available content view width. It should be a trivial task: just add the text field to the cell's content view, and resize all frames. The problem is that the detail text label is stubbornly obscuring the text field, even after being resized and sent to the back. (see attached picture) I realize that any frame adjustments must be done in -tableView: willDisplayCell: forRowAtIndexPath: rather than in the method that creates/reuses cells, but I wasn't expecting the order of content view subviews to change between those two methods. I verified that bringing the text field to the front in -tableView: cellForRowAtIndexPath: has no effect because the detail text label is brought to the front between that method and willDisplayCell. Maybe there is a reason for that, but I don't see it. But there's more... In the willDisplayCell method, I resize the text field and both labels, bring the text field to the front, and even send the detail text label to the back. I know that all that is done correctly, because on exit from -tableView: willDisplayCell: forRowAtIndexPath: the cell's content view's subviews array is: cell.contentView.subviews on exit from willDisplayCell: ( UILabel: 0xd36770; frame = (11 24; 135 18); text = 'Detail Label Detail Label...'; clipsToBounds = YES; userInteractionEnabled = NO; layer = CALayer: 0xd36160, UILabel: 0xd35de0; frame = (11 2; 135 22); text = 'Text Label Text Label Tex...'; clipsToBounds = YES; userInteractionEnabled = NO; layer = CALayer: 0xd360b0, UITextField: 0xd30220; frame = (155 10; 135 23); text = 'Text Field Text Field Tex...'; clipsToBounds = YES; opaque = NO; autoresize = LM; tag = 1; layer = CALayer: 0xd30680 ) Note how all the frame rectangles are correctly set and note also that the text field is above both labels, in the subview order. Yet, the cell displays as in the picture: both labels have the correct size but display as if they extended across the entire content view. Moreover, the detail text label refuses to be displayed in the back, even though it *is* in the back by the time the willDisplayCell method exits. Given how common something like this must be (reusing standard cells, with frame changes) and how fundamentally important the view hierarchy is, I'm inclined to think that the behavior I'm seeing isn't a bug but, rather, the result of something trivial that I'm missing. Yet, I can't see anything wrong with my code, so I'd appreciate if someone looked at the sample project I created, which can be downloaded from http://www.restlessbrain.com/cocoadev/UITableView_cell_display_bug.zip To summarize, there are 3 strange behaviors that I'm seeing: a. the subview order for the subviews of the cell's content view changes between exiting -tableView: cellForRowAtIndexPath: and entering -tableView: willDisplayCell: forRowAtIndexPath: b. the label frame rectangles are resized but the labels display as if the frames had not been changed. c. setting a specific subview order has no effect on how the labels are displayed. If I'm not missing anything obvious, I'll file a bug report. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] get iPhone's IP address...
Please note that NSHost is NOT publicly supported API on iPhone. Attempts to use it may result in unexpected behavior and broken applications in future iPhone revisions. Also, using private classes is a breach of the iPhone developer terms and conditions. Finally, using a private class such as NSHost should not be discussed on this list. Luke Sent from my iPhone. On Jul 19, 2009, at 10:50 PM, James Lin jamesclin...@gmail.com wrote: Hi all, I found this code snipet that's supposed to return the iPhone's IP address. I am wondering if anyone can confirm the method for me. As i am told that this method works in an actual iPhone and not on the simulator. But i won't have an iPhone until Aug 9th All i am getting in the simulator is something like : fe80::21e: 52ff:fec6:b7401.618407e-303n1 I am wondering if anyone can confirm the method works (ie, returns an actual ip address) on an actual iPhone for me The code: - (NSString*) getNetAddr { char iphone_ip[255]; strcpy(iphone_ip,127.0.0.1); // if everything fails NSHost *myhost =[NSHost currentHost]; //NSHost *myhost = [[NSHost alloc] init]; if (myhost) { NSLog(@myhost exits); NSString *ad = [myhost address]; if (ad) strcpy(iphone_ip, [ad cStringUsingEncoding: NSISOLatin1StringEncoding]); } return [NSString stringWithFormat:@%s, iphone_ip]; } Thank you in advance... James ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com This email sent to luket...@apple.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] get iPhone's IP address...
On Jul 20, 2009, at 12:50 AM, James Lin wrote: Hi all, I found this code snipet that's supposed to return the iPhone's IP address. I am wondering if anyone can confirm the method for me. As i am told that this method works in an actual iPhone and not on the simulator. But i won't have an iPhone until Aug 9th As others have mentioned, this code has problems. One major problem, however, is that there is no NSHost available on the iPhone (it'll work on the Simulator, but isn't supported on the iPhone). You should visit devforums.apple.com - this issue has been discussed in detail and sample code that actually works can be found there... Glenn Andreas gandr...@gandreas.com http://www.gandreas.com/ wicked fun! Mad, Bad, and Dangerous to Know ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] UITableView cell display bugs ?
Once upon a time Steve Christensen wrote: From what you've said below, you probably should be creating a custom cell type based on UITableViewCellStyleSubtitle and add the third label to your class. At least in NSTableView (I haven't yet played with the iPhone), a cell class determines what is drawn at a particular row/column location. Right now it sounds like you're fighting UITableView rather than working with it. I agree and recommend the following free Screencast from Pragmatic: http://pragmaticstudio.com/screencasts/5-custom-table-cells-in-interface-builder IB is the way to go, doing this via code is troublesome. BR /Johan PS. Sorry Steve, accidentally sent to you instead to the list. DS. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] get iPhone's IP address...
I should also have mentioned that you should be able to get the functionality you need via CFHost. Luke Sent from my iPhone. On Jul 20, 2009, at 6:33 AM, Luke Hiesterman luket...@apple.com wrote: Please note that NSHost is NOT publicly supported API on iPhone. Attempts to use it may result in unexpected behavior and broken applications in future iPhone revisions. Also, using private classes is a breach of the iPhone developer terms and conditions. Finally, using a private class such as NSHost should not be discussed on this list. Luke Sent from my iPhone. On Jul 19, 2009, at 10:50 PM, James Lin jamesclin...@gmail.com wrote: Hi all, I found this code snipet that's supposed to return the iPhone's IP address. I am wondering if anyone can confirm the method for me. As i am told that this method works in an actual iPhone and not on the simulator. But i won't have an iPhone until Aug 9th All i am getting in the simulator is something like : fe80::21e: 52ff:fec6:b7401.618407e-303n1 I am wondering if anyone can confirm the method works (ie, returns an actual ip address) on an actual iPhone for me The code: - (NSString*) getNetAddr { char iphone_ip[255]; strcpy(iphone_ip,127.0.0.1); // if everything fails NSHost *myhost =[NSHost currentHost]; //NSHost *myhost = [[NSHost alloc] init]; if (myhost) { NSLog(@myhost exits); NSString *ad = [myhost address]; if (ad) strcpy(iphone_ip, [ad cStringUsingEncoding: NSISOLatin1StringEncoding]); } return [NSString stringWithFormat:@%s, iphone_ip]; } Thank you in advance... James ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com This email sent to luket...@apple.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com This email sent to luket...@apple.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] UITableView cell display bugs ?
On Jul 20, 2009, at 1:35 AM, WT wrote: I'm trying to reuse (with some modifications) UITableViewCellStyleSubtitle cells, which have two left-aligned labels. I want to have both labels and add a right-aligned text field. All three views must be as wide as roughly half the available content view width. In order to do what you want you must subclass UITableViewCell and override layoutSubviews to do your layout. What is happening is your adding and moving around views before this layout has occurred, and then the default layout mechanism is resetting them. Your layoutSubviews override should call [super layoutSubviews] first. -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Open Recent menu - how to populate it?
Hi, All, I'm writing a simple (in GUI) application, where NSDocument is not used. I use NSOpenPanel to get a file name, then process file and close it. There is no UI, related to file, where NSDocument could help significantly. At least I believe so. My problem is that Recent menu is empty, because in Cocoa (AFAIK) it is maintained automatically by NSDocumentController, which is absent in my app. So, my question is - how to create and update the Open Recent menu manually? Where to store its items? How to populate this submenu when my app is loaded? Or should I use NSDocumentController anyway? Thanks. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Open Recent menu - how to populate it?
On 21/07/2009, at 1:36 AM, Alexander Bokovikov wrote: Hi, All, I'm writing a simple (in GUI) application, where NSDocument is not used. I use NSOpenPanel to get a file name, then process file and close it. There is no UI, related to file, where NSDocument could help significantly. At least I believe so. My problem is that Recent menu is empty, because in Cocoa (AFAIK) it is maintained automatically by NSDocumentController, which is absent in my app. So, my question is - how to create and update the Open Recent menu manually? Where to store its items? How to populate this submenu when my app is loaded? Or should I use NSDocumentController anyway? If your app isn't document based, it might complicate things too much to have an NSDocumentController there (which is a global/singleton). Handling a recent items menu is pretty straightforward though - just keep a list of the n most recent file paths you opened in an array and use a menu delegate to update the menu from this. For extra credit, check the validity/existence of the file when updating the menu and remove bad ones and disambiguate duplicates. Someone might have written a class to do this already. The relevant functionality could go in the app's delegate or a separate controller object with an outlet from the app's delegate. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Open Recent menu - how to populate it?
On 20.07.2009, at 21:47, Graham Cox wrote: ... and use a menu delegate to update the menu from this. This is just what is unclear for me, as I'm still learning Cocoa :) Do you have in mind that I must: 1 - create an outlet, pointing to Open Recent menu item 2 - create an outlet, pointing to the Main Menu itself (or is there any ready-to-use one?) 3 - set my AppController, as a Main Menu delegate (e.g. in awaikFromNib, using outlet, created in #2) 4 - add some delegate message to my AppController class (what message should I intercept?) 5 - write some code like populating submenu of the menu item referenced by outlet, created in #1 If the sequence above is correct, then, OK, I'll try to do it, though I have one unclear point - will newly created menu items respond to onClick: action automatically, or should I assign onClick: action for each dynamically created item? If I should, then how to do it? For extra credit, check the validity/existence of the file when updating the menu and remove bad ones and disambiguate duplicates. Someone might have written a class to do this already. This is obvious, but my problem is in the menu dynamic creation. On 20.07.2009, at 21:55, Tony S. Wu wrote: i'd store the plist file in Library/Application support folder, and just process the file upon startup. Am I correct in my understanding, that my application can create a subdirectory within /Library/Application Support/ directory? Or should it be done through an installer, where Administrator's password is asked? Thanks. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Open Recent menu - how to populate it?
You can just go ahead and invoke -noteNewRecentDocumentURL: on [NSDocumentController sharedDocumentController]. You don't have to worry about explicitly creating or managing an NSDocumentController, or do anything else that requires NSDocument. TextEdit in Tiger did this (before it was converted to NSDocument). Ali On Jul 20, 2009, at 8:47 , Graham Cox wrote: On 21/07/2009, at 1:36 AM, Alexander Bokovikov wrote: Hi, All, I'm writing a simple (in GUI) application, where NSDocument is not used. I use NSOpenPanel to get a file name, then process file and close it. There is no UI, related to file, where NSDocument could help significantly. At least I believe so. My problem is that Recent menu is empty, because in Cocoa (AFAIK) it is maintained automatically by NSDocumentController, which is absent in my app. So, my question is - how to create and update the Open Recent menu manually? Where to store its items? How to populate this submenu when my app is loaded? Or should I use NSDocumentController anyway? If your app isn't document based, it might complicate things too much to have an NSDocumentController there (which is a global/ singleton). Handling a recent items menu is pretty straightforward though - just keep a list of the n most recent file paths you opened in an array and use a menu delegate to update the menu from this. For extra credit, check the validity/existence of the file when updating the menu and remove bad ones and disambiguate duplicates. Someone might have written a class to do this already. The relevant functionality could go in the app's delegate or a separate controller object with an outlet from the app's delegate. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Open Recent menu - how to populate it?
On 20.07.2009, at 23:13, Ali Ozer wrote: You probably want to call this when you open a doc, or revert, or do save as... (if you have any of these commands in your app, of course). Das ist fantastisch... 8-( ) [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:[NSURL URLWithString:filename]]; Just one line of code Thank you very much! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Getting a CoreAnimation layer frame, accounting for zPosition?
This might be a stupid question, but I've searched around and found no answers. I have a CoreAnimation layer with a zPosition 0. If its 3D transform is CATransform3DIdentity, how do I get its exact frame as it appears on the screen? I already tried -bounds, and -visibleRect, and -convertRect:toLayer: with the toLayer being the view's body layer, and they all ignored the zPosition and returned the frames they would use if their zPosition was 0. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSDateFormatter issue (bug maybe)?
When you're generating/parsing a date format that's supposed to be stable like this, you should control the locale/calendar used by the formatter instead of letting the user settings control it. For example, your data can be entirely off when the user's calendar is not Gregorian. Instead, you should specify the system locale, [NSLocale systemLocale], and the gregorian calendar, [[NSCalendar alloc] initWithCalendarIdentifier:@gregorian], explicitly. Aki On 2009/07/18, at 13:03, James Gillespie wrote: Hi All, Thanks in advance for any help on this issue. I have a file that uses the following format for date and times: (4 digit year)-(2 digit month)-(2 digit day)T(2 digit hour, 0-23):(2 digit minute):(2 digit seconds)-(4 digit offset from GMT) Example: 2009-07-17T17:12:20-0700 I am using an NSDateFormatter with a custom date format to read these dates. formatter = [[NSDateFormatter alloc] init]; [formatter setFormatterBehavior:NSDateFormatterBehavior10_4]; [formatter setDateFormat:@-MM-dd'T'HH:mm:ssZZZ]; On the Mac this works great for any combination of Region setting and 24hr/AM,PM settings. On the iPhone (both iPhone OS 2.2.1 and 3.0) this does not work if the Region setting is set to something that defaults to 24hr time (like UK, France, and Thai) but the time display setting is set by the user to AM/PM. For example: on the iPhone if in Settings you set the region to UK and turn 24-Hour Time off. When the phone is configured like this the above code wants to read and write dates with the following format. (4 digit year)-(2 digit month)-(2 digit day)T(2 digit hour, 0-23):(2 digit minute):(2 digit seconds) (AM/PM)-(4 digit offset from GMT) Example: 2009-07-17T17:12:20 PM-0700 This is not the behavior I would have expected. Am I configuring NSDateFormatter correctly? Is this a bug I should file in Radar? Again any help is greatly appreciated. We have an app in the App Store with this issue and it is causing some customers issues. Thanks, James ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/aki%40apple.com This email sent to a...@apple.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to schedule an application
Take a look at an application I publish called Script Timer. It will do what you want. It has a wide variety of scheduling options: specified time of the day, week, month, or year, on a repeating interval, and when certain events occur such as the start or end of idle of your computer, as well as 6 other events. More details can be found at http://www.appsandmore.com. Scheduling an Applescript using iCal is another possibility, though less convenient in my (probably biased) opinion. As Jerry points out, unless your program automatically runs the desired task when it launches, that task will have to be Applescriptable. In that case you would schedule your script with Script Timer, iCal, or launchd. Don Hall At 11:33 AM -0700 7/20/09, cocoa-dev-requ...@lists.apple.com wrote: hi, I want to schedule my application on a specified time. When the application is not running , the application should open on the specified time and process the scheduled task . If the application is running , the scheduled task should be processed within the application [without opening in a new application]. I had tried using a plist file and launchd to do it, but it always opens in a new application. Is this can be done using applescript ? thank you in advance. -- Donald S. Hall, Ph.D. Apps More Software Design, Inc. d...@appsandmore.com http://www.appsandmore.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How do I track down an OSStatus error code?
Looking for the meaning behind the value -43. -Michael smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How do I track down an OSStatus error code?
Looking for the meaning behind the value -43. Try MacErrors.h in CarbonCore. -Ben ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How do I track down an OSStatus error code?
On Jul 20, 2009, at 3:04 PM, Benjamin Stiglitz wrote: Looking for the meaning behind the value -43. Try MacErrors.h in CarbonCore. Or just type macerror -43 at a command shell. Cheers, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How do I track down an OSStatus error code?
Hello Michael, Monday, July 20, 2009, 9:00:18 PM, you wrote: Looking for the meaning behind the value -43. -Michael GetMacOSStatusCommentString() defined in CoreServices -- Best regards, Petermailto:darkmat...@blueyonder.co.uk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Getting a CoreAnimation layer frame, accounting for zPosition?
On Jul 20, 2009, at 11:30 AM, Nick Zitzmann wrote: This might be a stupid question, but I've searched around and found no answers. I have a CoreAnimation layer with a zPosition 0. If its 3D transform is CATransform3DIdentity, how do I get its exact frame as it appears on the screen? zPosition != 0 does not necessarily mean that there is any difference in the layer's frame. Unless there is a transform somewhere that creates perspective, the zPosition has no effect on the layer's frame (because the z component falls out of all the applicable equations). What are you trying to implement? -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Alter Table Equivalent in Core Data?
Using plain SQLite one can use alter table to add/remove table columns after the table has been created. In the same (or not the same) way, is it somehow possible to dynamically add attributes to an entity? This would, among other things, involve that when a new attribute is added, all existing MOs (and their persistent counterparts; what are they called again?) will now respond properly to that new attribute. And when an attribute is removed, it gets gracefully deleted from all MOs (and their persistent counterparts; am I even using the correct words over here? I hope you get my point). _ With Windows Live, you can organize, edit, and share your photos. http://www.microsoft.com/middleeast/windows/windowslive/products/photo-gallery-edit.aspx___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Getting a CoreAnimation layer frame, accounting for zPosition?
On Jul 20, 2009, at 2:25 PM, David Duncan wrote: zPosition != 0 does not necessarily mean that there is any difference in the layer's frame. Unless there is a transform somewhere that creates perspective, the zPosition has no effect on the layer's frame (because the z component falls out of all the applicable equations). What are you trying to implement? I'm trying to implement getting the on-screen frame of a layer that has a superlayer that has a sublayerTransform that creates perspective. How do I do that? Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Alter Table Equivalent in Core Data?
The only way to do this is through migration: http://devworld.apple.com/documentation/Cocoa/Conceptual/CoreDataVersioning/index.html On 20 Jul 2009, at 21:33, Squ Aire wrote: Using plain SQLite one can use alter table to add/remove table columns after the table has been created. In the same (or not the same) way, is it somehow possible to dynamically add attributes to an entity? This would, among other things, involve that when a new attribute is added, all existing MOs (and their persistent counterparts; what are they called again?) will now respond properly to that new attribute. And when an attribute is removed, it gets gracefully deleted from all MOs (and their persistent counterparts; am I even using the correct words over here? I hope you get my point). _ With Windows Live, you can organize, edit, and share your photos. http://www.microsoft.com/middleeast/windows/windowslive/products/photo-gallery-edit.aspx___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
UIButton image disables shows touch on highlight?
Is it expected, normal, documented(?) that putting an image onto a UIButton turns OFF (in practice) the shows touch on highlight property? For the life of me I cannot get this to work, neither in the simulator nor on the device. Ideas/suggestions? randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Crashes while reordering columns in a NSTableView
Hi all, I am having a lot of problems with NSTableView crashing my application, when reordering (dragging) columns. The crashes either take down the whole app and all I get is the following message: Error: __CGPixelAccessDataInitialize: vm_copy failed: status 1. or, it manages to break into the debugger with stack-traces like the following (nearly all crashes happen in CGBlt_copyBytes with an EXC_BAD_ACCESS signal. Thread 1: #0 0x90ec0fb9 in CGBlt_copyBytes () #1 0x90ef7e70 in __CGPixelAccessDataInitialize () #2 0x9144b010 in __CGPixelAccessAccessBitmapData () #3 0x90f2eab8 in __CGPixelAccessCreateImageFromRect () #4 0x90f2e916 in CGPixelAccessCreateImageFromRect () #5 0x90720ec5 in -[NSCGImageRep initWithFocusedViewRect:] () #6 0x906544cc in -[NSTableView _captureReorderResizeColumnImageCaches] () #7 0x90653261 in -[NSTableView drawRect:] () #8 0x9072c75a in -[NSView(NSInternal) _recursive:displayRectIgnoringOpacity:inContext:topView:] () #9 0x90cc7f08 in -[NSView(NSLayerKitGlue) drawLayer:inContext:] () #10 0x96c7bf00 in -[CALayer drawInContext:] () #11 0x96e7036c in tiled_layer_render () #12 0x96e2a267 in source_perform () #13 0x9737b595 in CFRunLoopRunSpecific () #14 0x9737bc78 in CFRunLoopRunInMode () #15 0x939b928c in RunCurrentEventLoopInMode () #16 0x939b8fde in ReceiveNextEventCommon () #17 0x939b8f19 in BlockUntilNextEventMatchingListInMode () #18 0x9061ad0d in _DPSNextEvent () #19 0x9061a5c0 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] () #20 0x90b91d59 in -[NSTableHeaderView _lastDraggedOrUpEventFollowing:canceled:] () #21 0x90b92426 in -[NSTableHeaderView _reorderColumn:withEvent:] () #22 0x908d6c63 in -[NSTableHeaderView mouseDown:] () #23 0x906e9133 in -[NSWindow sendEvent:] () #24 0x906b5cd9 in -[NSApplication sendEvent:] () #25 0x9061362f in -[NSApplication run] () #26 0x905e0834 in NSApplicationMain () #27 0x2af2 in main (argc=1, argv=0xb640) at X/main.m: 13 Thread 2: #0 0x9368446e in __semwait_signal () #1 0x936af3e6 in _pthread_cond_wait () #2 0x936aedcd in pthread_cond_wait$UNIX2003 () #3 0x931d9329 in CVDisplayLink::runIOThread () #4 0x936ae155 in _pthread_start () #5 0x936ae012 in thread_start () Thread 3: #0 0x9368446e in __semwait_signal () #1 0x936af3e6 in _pthread_cond_wait () #2 0x936aedcd in pthread_cond_wait$UNIX2003 () #3 0x964beb32 in glvmDoWork () #4 0x936ae155 in _pthread_start () #5 0x936ae012 in thread_start () Reordering columns also leads to strange artifacts (it works for a few seconds before it crashes...). Said table is programmatically manipulated at runtime (i.e. columns are removed | added). The superview uses CG. Xcode also occasionally dumps the following to console if gdb manages to break: Xcode could not locate source file: cpu_capabilities.h (line: 246) Is there any way to work around this, as Column reordering is a pretty important feature for this tool Very best regards, Tim Schmidt ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
NSBrowser's current selection
Hi, I'm using an NSBrowser with old-fashioned delegate methods. How can I be notified when the selection changes, and then get the correct object value for that row and column? Both NSBrowser delegate methods – browser:selectCellWithString:inColumn: and – browser:selectRow:inColumn: which the documentation states that ask the delegate to select never get called. Then there's the -loadedCellAtRow:Column: method. The documentation states it loads, if necessary, the cell and returns. Does this mean it calls -browser:willDisplayCell:atRow:Column: to set the value before returning it? Any help appreciated, thanks. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Cocoa Graphics Parsing
Hello all, I need to programmatically parse/read through the contents of an NSImage. I am unable to find a tutorial or documentation that would explain how to do so. I would like to get some input on where I may be able to search for this information. thank you, ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Best approach for selective spell-checking...
I'm trying to figure out how to prevent spell checking in my NSTextView from being applied to certain ranges within the text document. For context, the situation I'm in is my application, MarsEdit, allows users to edit HTML source code in a regular NSTextView. In a nutshell, I want to spell-check the users plain-text content but avoid triggering spell-check false positives inside the HTML markup. I'm already colorizing the markup text, so it would be reasonably easy for me to do something in that colorizing pass that identifies the off-limits nature of the markup text. I could for instance easily maintain an array of ranges for a document that should not be spell- checked. The question is, how do I best limit the spell checker from applying itself to this text? So far I've been taking advantage of check as I type for both grammar and spelling. This seems like the most user- friendly way to support spell checking. Do I need to switch to a manual approach, using NSSpellChecker's checkSpellingOfString:startingAt: ? Would it be possible to use this manually in a manner that simulates check as I type? It would be nice if NSSpellChecker offered a delegate relationship, something like willMarkMispelledWordInRange: ... where I could choose to have it keep quiet instead. Appreciate any suggestions people have for me. Daniel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSBrowser's current selection
On 21/07/2009, at 11:28 AM, Chase Meadors wrote: I'm using an NSBrowser with old-fashioned delegate methods. How can I be notified when the selection changes, and then get the correct object value for that row and column? Both NSBrowser delegate methods – browser:selectCellWithString:inColumn: and – browser:selectRow:inColumn: which the documentation states that ask the delegate to select never get called. Are you certain the delegate is actually set? Do other delegate methods get called? How did you set the delegate? How you determine the relevant object in your data model is up to you - you have row and column indexes, your controller has to convert that to some way of referencing the object. Most straightforwardly it can simply pass the index(es) to NSArray's -objectAtIndex: m ethod. Then there's the -loadedCellAtRow:Column: method. The documentation states it loads, if necessary, the cell and returns. Does this mean it calls -browser:willDisplayCell:atRow:Column: to set the value before returning it? That's my interpretation, yes, or at any rate, that's how the cell is given its content whenever necessary. But you must also implement either - (NSInteger)browser:(NSBrowser *)sender numberOfRowsInColumn: (NSInteger)column or - (void)browser:(NSBrowser *)sender createRowsForColumn:(NSInteger)column inMatrix:(NSMatrix *)matrix (but not both). --Graham___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Cocoa Graphics Parsing
On 21/07/2009, at 11:50 AM, Courtney Arnold wrote: I need to programmatically parse/read through the contents of an NSImage. I am unable to find a tutorial or documentation that would explain how to do so. I would like to get some input on where I may be able to search for this information. Possibly because your question doesn't make much sense. What do you mean by Parse through. NSImage consists of one or more NSImageReps, each of those contains an image in a different format. Typically this would be a bitmap image which consists of blocks of pixels, but it could also be a PDF image that contains postscript. So what sort of image data are you talking about, and what do you mean by parse? --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Cocoa Graphics Parsing
I am expecting that I am going to have to drop down to lower levels. I want to be able to manually parse an image of a UPC barcode. I assume that the best way to do so would be to potentially examine each single pixel. any information that you provide, I would appreciate it. On Jul 20, 2009, at 7:51 PM, I. Savant wrote: On Jul 20, 2009, at 9:50 PM, Courtney Arnold wrote: I need to programmatically parse/read through the contents of an NSImage. I am unable to find a tutorial or documentation that would explain how to do so. I would like to get some input on where I may be able to search for this information. That depends on what you mean by parse/read through. Exactly what are you trying to do? What kinds of images (raster, vector)? Does it have to be NSImage or are you willing to drop to a lower level? -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Best approach for selective spell-checking...
Daniel Jalkut wrote: For context, the situation I'm in is my application, MarsEdit, allows users to edit HTML source code in a regular NSTextView. In a nutshell, I want to spell-check the users plain-text content but avoid triggering spell-check false positives inside the HTML markup. I'm already colorizing the markup text, so it would be reasonably easy for me to do something in that colorizing pass that identifies the off-limits nature of the markup text. I could for instance easily maintain an array of ranges for a document that should not be spell- checked. Maybe add the colorized words to a dynamic dictionary, which you then pass to the spell-checker. Since the markup words are in the dictionary, they won't be considered misspelled. -- GG ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Core Data, NSArraycontrollers and secondary to-many relationships.
Hey folks, I'm working on a little project: http://recon-mac.googlecode.com , a frontend for Nmap. My Core Data model looks like this: http://recon-mac.googlecode.com/files/recon_datamodel.png I'd like to use a NSTableview to display a list of unique ports in a selected session. As you can see, the relationship between Session is a tiered two-many relationship. I have NSArrayControllers bound to the MOC for Session, Host, and Port. The relationships are also configured correctly. ie. Other, simpler, view work great. I've spent a few days playing with NSArrayControllers, fiddling with Content Array, Content Set, Content Object settings; tried understanding @distinctUnionOfSets and @distinctUnionOfArrays; but I've hit a wall. So... how do I do it. I know the solution must be embarrassingly simple, but it's eluded me. Best, Sumanth P. http://bafoontecha.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSPasteboard and data types
Dave, I've worked with UIPasteboard, which I'm assuming is similar. dataForType: will contain string data if it's a type such as UTF8 text. My own PasteboardItem class had just data (NSData) and type (NSString) properties, and it's worked fine for everything. Once you have the type and data, you can then write methods to convert to strings or whatnot. Michael Hoy michael.john@gmail.com On Jul 18, 2009, at 1:52 PM, Dave DeLong wrote: Hi everyone, I'm playing around with NSPasteboard in 10.5 and want to basically create a copy of the generalPasteboard. I've got two classes: DDPasteboard and DDPasteboardItem. DDPasteboard has a to-many relationship with DDPasteboardItem. What I'm wondering is this: do I need to have separate string and data properties in DDPasteboardItem? I see that I can grab stringForType: and dataForType: from the pasteboard, but what's the difference between them (other than one returning an NSString and the other an NSData)? In the documentation I see that stringForType: just invokes dataForType:, but is there ever an instance where stringForType: would return something different than can be inferred from dataForType:? Thanks, Dave DeLong ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/michael.john.hoy%40gmail.com This email sent to michael.john@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Post method - NSMutableURLRequest
Hello, I am trying to get information from a website with post method but I cannot get the right content. This is the website. I should get the bus schedule which is displayed after you enter number in the field on the first page.HTML Code: http://wbus.talktrack.com/ . Here is the code of the website:Code: htmlbody form id=Form1 name=Form1 method=post action=wap.aspx?__ufps=666968 input type=hidden name=__EVENTTARGET value= input type=hidden name=__EVENTARGUMENT value= script language=javascript!-- function __doPostBack(target, argument){ var theform = document.Form1 theform.__EVENTTARGET.value = target theform.__EVENTARGUMENT.value = argument theform.submit() } // -- /script div align=Centerimg src=img/waplogo.gif alt=LPP border=0 /br LPP - Napoved prihodov avtobusov.br Vnesite ime postajebr input name=tb_postaja/br input name=b_send type=submit value=Prikaži/br a href=wap.aspx?culture=sl-SIslo/a | a href=wap.aspx?culture=en-GBeng/a/div/form/body/html When you enter the number into the field you should get the bus schedule. Here is my code:Code: NSString *post = @tb_postaja=163; NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:NO]; NSString *postLength = [NSString stringWithFormat:@%d, [postData length]]; NSMutableURLRequest *urlRequest = [[[NSMutableURLRequest alloc] init] autorelease]; NSString *testString =@http://wbus.talktrack.com/;; //testString = [testString stringByAppendingString:string2]; [urlRequest setURL:[NSURL URLWithString:testString]]; [urlRequest setHTTPMethod:@POST]; [urlRequest setValue:postLength forHTTPHeaderField:@Content-Length]; [urlRequest setValue:@application/x-www-form-urlencoded forHTTPHeaderField:@Content-Type]; [urlRequest setHTTPBody:postData]; NSData *urlData; NSURLResponse *response; NSError *error; urlData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:response error:error]; NSLog(@Succeeded! Received %d bytes of data,[urlData length]); NSString *aStr = [[NSString alloc] initWithData:urlData encoding:NSASCIIStringEncoding]; NSLog(aStr); . Thanks in advance. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[iPhone] CFAttributedStringRef autorelease - not possible?
Here's some code: NSString *m_scanString = @This is a test.; CFDictionaryRef emptyDic = (CFDictionaryRef)[NSDictionary dictionary]; CFAttributedStringRef attString = CFAttributedStringCreate(kCFAllocatorDefault, (CFStringRef)m_scanString, emptyDic); CFMutableAttributedStringRef linkifiedString = CFAttributedStringCreateMutableCopy(kCFAllocatorDefault, 0, attString); NSLog(@%@, (NSString *)CFAttributedStringGetString(linkifiedString)); [(id)linkifiedString autorelease]; Testing in a Mac OS 10.5 SDK, this code works. In the iPhone 3.1 SDK, the last line of code (calling autorelease on CFMutableAttributedStringRef) gives EXC_BAD_ACCESS. Everything else works as expected. Is CFAttributedStringRef not castable to id or NSObject* in the iPhone environment? Thanks, ~ Michael Hoy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
fileManager:shouldMoveItemAtPath:toPath is never called
Hi, I'm having a problem with moving files using moveItemAtPath:toPath:error from NSFileManager. The operation moves a file as it should, but associated delegate method is not called (fileManager:shouldMoveItemAtPath:toPath). If I switch from moving to copying (that is when I use copyItemAtPath:toPath:error instead of moveItemAtPath:toPath:error) the equivalent delegate works fine. I made a sample source code to show what the problem is - I'm including it below. When I compile it and run in XCode 3.1.3 (on OSX 10.5.7) it just prints OK and not Test move so that the delegate is not called. And the file is moved as it should be... Have you seen this before? Regards #import Foundation/Foundation.h @interface Test : NSObject { } - (BOOL)fileManager:(NSFileManager *)fileManager shouldMoveItemAtPath: (NSString *)srcPath toPath:(NSString *)dstPath; @end @implementation Test - (BOOL)fileManager:(NSFileManager *)fileManager shouldMoveItemAtPath: (NSString *)srcPath toPath:(NSString *)dstPath { NSLog(@Test move); return YES; } @end int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSFileManager *fm = [NSFileManager defaultManager]; if ([fm createFileAtPath:@./test.txt contents:@test attributes:nil]) { Test *t = [[Test alloc] init]; [fm setDelegate:t]; NSError *err; if ([fm moveItemAtPath:@./test.txt toPath:@./test1.txt error:err] == NO) { NSLog(@Error: %@, [err localizedDescription]); } else { NSLog(@OK); } [t release]; } else { NSLog(@Cannot create a test file); } [pool drain]; return 0; } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
CoreData could not fulfill a fault for...
Hi all,I have a strange problem with my app. I have an entity named Item and a one to one relationship with another Download entity. When I want to download an item... I create the entity download with some property related to size and status of the download. I use a download controller to show the current downloads. When I stop a download I remove the download entity from the managed object context and save everything. But after all this, the console shows me this log: *CoreData could not fulfill a fault for '0x1b1970 x-coredata://B6A18328-7952-4068-8491-27EE905B1D04/Download/p148'* * * I don't have any Download object right now. The only thing I display is the download.item.title property... when there are downloads. But now that I have stopped it shouldn't be called because the downloads controller has no download objects. I also setted delete rules in this way: Item has a cascade delete rule on Download relationship, Download instead has a nullify rule on the inverse to Item. What am I doing wrong? I noticed that if I remove the only binding (downloadsController.selection item.title on the collection view displaying the downloads) I have no warnings at all. Having said that, however my program runs fine even with these logs. But I need to know what could be wrong. Thanks everybody. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Show UIButton Highlight Without Touching?
is there a method within the iPhone SDK that will set off the highlight of a button without actually touching the button? i have a lock button that locks a movable object on screen. if the lock button is pressed and the object is locked, i would like the button to highlight to signify that the object is locked and draw the attention of the user to the lock button if the user tries to move the object. the only thing mentioned in the docs is the boolean showsTouchWhenHighlighted, so i'm assuming i'll have to make my own custom highlight if i want this functionality. any thoughts? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Cocoa Graphics Parsing
Hi Courtney, Two resources that you might consider are the Quartz-dev mailing list and Programming with Quartz by David Gelphman. HTH, Joel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Best approach for selective spell-checking...
On Jul 20, 2009, at 9:48 PM, Daniel Jalkut wrote: I'm trying to figure out how to prevent spell checking in my NSTextView from being applied to certain ranges within the text document. [...] It would be nice if NSSpellChecker offered a delegate relationship, something like willMarkMispelledWordInRange: ... where I could choose to have it keep quiet instead. On 10.5 and later, there is public API which you can override in your NSTextView subclass: - (void)setSpellingState:(NSInteger)value range:(NSRange)charRange; // May be called or overridden to control setting of spelling and grammar indicators. Values are those listed for NSSpellingStateAttributeName. Calls the delegate method textView:shouldSetSpellingState:range:. or the delegate variant: - (NSInteger)textView:(NSTextView *)textView shouldSetSpellingState: (NSInteger)value range:(NSRange)affectedCharRange; // Delegate only. Allows delegate to control the setting of spelling and grammar indicators. Values are those listed for NSSpellingStateAttributeName. If you need to support 10.4, perhaps you can use a custom layout manager which avoids setting the temporary spelling attributes for ranges you don't wish to display misspellings for. Jim ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Show UIButton Highlight Without Touching?
[yourButton setHighlighted: YES]? (from UIControl) Brian On Jul 20, 2009, at 4:14 PM, Chunk 1978 wrote: is there a method within the iPhone SDK that will set off the highlight of a button without actually touching the button? i have a lock button that locks a movable object on screen. if the lock button is pressed and the object is locked, i would like the button to highlight to signify that the object is locked and draw the attention of the user to the lock button if the user tries to move the object. the only thing mentioned in the docs is the boolean showsTouchWhenHighlighted, so i'm assuming i'll have to make my own custom highlight if i want this functionality. any thoughts? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/brianslick%40mac.com This email sent to briansl...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Cocoa Graphics Parsing
On 21/07/2009, at 12:25 PM, Courtney Arnold wrote: I am expecting that I am going to have to drop down to lower levels. I want to be able to manually parse an image of a UPC barcode. I assume that the best way to do so would be to potentially examine each single pixel. any information that you provide, I would appreciate it. Well, if you're looking for -getBarcode: from NSImage, you're obviously out of luck. All you can do is scan the pixels, that's all that's in there, NSImage and NSImageRep do not interpret the content beyond pixels. However, you could do this by subclassing NSImageRep (or NSBitmapImageRep) and adding methods that do interpret barcodes at this level. You still have to do the work but this approach would give you a nice high-level interface to it. Internally, you have -getPixel:atX:y: which would presumably be the workhorse at the heart of your class. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Cocoa Graphics Parsing
On Jul 20, 2009, at 7:25 PM, Courtney Arnold wrote: I want to be able to manually parse an image of a UPC barcode. That's not parsing, that's image recognition. There's a rather extensive academic literature on the subject. -jcr ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
NSTextView help
Hey everyone, I've got an interesting problem that I thought I could find the answer to, but have come up short so far. I'm building a master-detail interface, similar to Mail.app. I'm struggling with the detail view (displaying the currently selected item). In Mail, there are areas for the From:, Subject:, To:, etc, with a rich-text area underneath. This is what I'd like to recreate. I have it *kind of* working, but not how I'd like. I have some rich text of arbitrary length that I want to display along with the item's metadata (similar to Mail's From and Subject fields). However, I want all of these to be part of the same NSScrollView, so that when I scroll, both the metadata fields and the rich text content move. The problem I'm facing is that in order to display the RTF data properly, I need an NSTextView, but NSTextView has its own enclosing scroll view that's conflicting with my overall scrollview. In addition, I need to be able to dynamically resize the overall clipped view so that the scrollbars change appropriately. I might be able to use the WebView object to fake it, but that seems like a less-elegant solution. However, if it's the only one, I suppose I could go with that and then just use CSS to style everything. So, in a nutshell, how can I recreate the detail view as found in Mail.app? Thanks, Dave DeLong ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Best approach for selective spell-checking...
Hi Jim - On Jul 20, 2009, at 11:01pm, Jim Correia wrote: It would be nice if NSSpellChecker offered a delegate relationship, something like willMarkMispelledWordInRange: ... where I could choose to have it keep quiet instead. or the delegate variant: - (NSInteger)textView:(NSTextView *)textView shouldSetSpellingState: (NSInteger)value range:(NSRange)affectedCharRange; // Delegate only. Allows delegate to control the setting of spelling and grammar indicators. Values are those listed for NSSpellingStateAttributeName. Hmm OK :) It sounds like I have some more reading to do. Thanks for letting me know to RTFM so gently... D ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Mouse move messages sent to both superview and a subview
On Jul 19, 2009, at 12:39 AM, Oleg Krupnov wrote: I want to display one view on top on the other view, so according to the documentation, I nest the topmost view inside the background view. It works just fine except that the mouse move messages are sent to both the subview and the superview, whereas I'd like them to be directed only to the subview when it's visible. Why is this happening? I used to think that normally the same mouse messages cannot be delivered to more than one view. What is my mistake? Thanks! I believe that any number of views can get mouseMoved events if they get a -setAcceptsMouseMoved:YES message. They're not like mouseDown and mouseUp. -jcr ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Cocoa Graphics Parsing
On 21/07/2009, at 12:25 PM, Courtney Arnold wrote: I am expecting that I am going to have to drop down to lower levels. I want to be able to manually parse an image of a UPC barcode. I assume that the best way to do so would be to potentially examine each single pixel. As others have pointed out, just examining each pixel is very far from being able to detect a barcode. You are going to have to do some work. You might want to have a look at this project: http://sourceforge.net/projects/osxrecognition/ -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSTextView help
On Jul 20, 2009, at 11:49 PM, Dave DeLong wrote: The problem I'm facing is that in order to display the RTF data properly, I need an NSTextView, but NSTextView has its own enclosing scroll view that's conflicting with my overall scrollview. NSTextView doesn't intrinsically have its own scroll view. When you drag a text view (or a table view) out of the Library pallet in IB, you are actually dragging an NSScrollView with an NSTextView as the document view since this is a typically useful configuration. If some other configuration is more useful to you, feel free to configure the view hierarchy that way. Look at the TextSizingExample in the examples folder for examples of other common configurations. - Jim ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
What are the finer points to programatically loading a view from a NIB and attaching to the default window in MainMenu.xib?
I've tried the following but I get no output (the view is blank). - (void)awakeFromNib { ndViewController = [[NDViewController alloc] initWithNibName:@NDView bundle:nil]; #if 1 [window.contentView addSubview:ndViewController.view]; #else [window setContentView:ndViewController.view]; #endif } The NIB file is loaded in that I was able set a breakpoint on - [awakeFromNib] for the NDView class. Yet, I don't see any output. If I remove the controller and use IB to add the NDView to the window as a custom-view. I can see the view and works fine. I've tried both the -[setContent] -[addSubview] calls. Perhaps someone can point to a sample or has a check-list of steps to take when manually loading views from nibs and attaching them to existing windows? Thanks. -Michael smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: What are the finer points to programatically loading a view from a NIB and attaching to the default window in MainMenu.xib?
On Jul 20, 2009, at 9:28 PM, Michael A. Crawford michaelacrawf...@mac.com wrote: The NIB file is loaded in that I was able set a breakpoint on - [awakeFromNib] for the NDView class. Yet, I don't see any output. If I remove the controller and use IB to add the NDView to the window as a custom-view. I can see the view and works fine. I've tried both the -[setContent] -[addSubview] calls. You're in the debugger; that's an important first step. But you need to verify that your window outlet isn't nil (as well as the view controller's view). If all else fails, remember that you can evaluate expressions and invoke arbitrary statements in the gdb console. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: What are the finer points to programatically loading a view from a NIB and attaching to the default window in MainMenu.xib?
On Jul 20, 2009, at 21:28, Michael A. Crawford wrote: I've tried the following but I get no output (the view is blank). - (void)awakeFromNib { ndViewController = [[NDViewController alloc] initWithNibName:@NDView bundle:nil]; #if 1 [window.contentView addSubview:ndViewController.view]; #else [window setContentView:ndViewController.view]; #endif } The NIB file is loaded in that I was able set a breakpoint on - [awakeFromNib] for the NDView class. Yet, I don't see any output. If I remove the controller and use IB to add the NDView to the window as a custom-view. I can see the view and works fine. I've tried both the -[setContent] -[addSubview] calls. Perhaps someone can point to a sample or has a check-list of steps to take when manually loading views from nibs and attaching them to existing windows? The thing I always forget is to connect the File's Owner 'view' outlet to the view in the nib 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: NSTextView help
Thanks for the suggestion! Just from glancing over the example, this seems like it will yield a lot of good help. Thanks again, Dave On Jul 20, 2009, at 10:19 PM, Jim Correia wrote: On Jul 20, 2009, at 11:49 PM, Dave DeLong wrote: The problem I'm facing is that in order to display the RTF data properly, I need an NSTextView, but NSTextView has its own enclosing scroll view that's conflicting with my overall scrollview. NSTextView doesn't intrinsically have its own scroll view. When you drag a text view (or a table view) out of the Library pallet in IB, you are actually dragging an NSScrollView with an NSTextView as the document view since this is a typically useful configuration. If some other configuration is more useful to you, feel free to configure the view hierarchy that way. Look at the TextSizingExample in the examples folder for examples of other common configurations. - Jim ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: intelligent flexible popup
I seem to have fallen into the pitfall you described below. I can get the table view to display values in a combo box from a data source, which takes those values from an array in the model. I also have autocomplete working. But I can't seem to get the values I choose to stick (remain displayed) in the table. Since the tableview is reusing the combo box cell, I don't see how you specify a different value for each row (I only have one column). (The choice values do appear when you click the arrow, but selecting them does not store a value.) Also, I'm not clear on when you capture a selection to get the value transferred to the model. Are you supposed to use some notification to know that the field has been edited, and then capture that value and transfer it to the model. Sorry if this seems basic, but I've looked over the documentation and some sample code and just don't get it. Thanks . On Jul 20, 2009, at 4:38 AM, cocoa-dev-requ...@lists.apple.com wrote: On Jul 19, 2009, at 7:58 PM, Quincey Morris wrote: ... and you'd *still* have to prevent the table view from treating [NSComboBoxCell] like a text field. In what way? Are you referring to the fact that a menu can represent an object, whereas a combo box is just a (possibly-pre-baked-chosen-from-the- menu) string? In both cases it's not the NSTableView but your custom data source that would make these decisions (ie, what that new object that was set really means in that context). I meant, if you used the NSComboBox methods that told you which item of the popup list was chosen (e.g. indexOfSelectedItem), you'd know what was chosen -- if something *was* chosen from the list -- as a selection index, but the table view would nevertheless set the underlying string as the value of the property bound to the column. Storing or using such combo box selection indexes is tricky to do with a table view, because they don't fit into the bindings *or* the data source patterns. Even knowing where you might usefully call these selected item methods is puzzling. So yes, if you understand that the value corresponding to the column is a string which *may* match (isEqualToString:, not ==) a list of strings you separately maintain, then there's no problem. The easy-to-fall-into pitfall is having the data model property be an index into an array of (say) state names, but returning the string name of the state in place of the index when supplying data to the table view. In that case, changing the string for one row changes that string everywhere it's used, which is usually not what's intended. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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