Running run loops in 10.6 (was: Need -[NSTask waitUntilExitOrTimeout:])

2009-09-18 Thread Jerry Krinock
On 2009 Sep 16, at 14:07, Chris Kane wrote: On Sep 14, 2009, at 6:29 PM, I wrote: [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:limitTime] ; // The above will block and be run to here either due to // the posting of an

NSView / NSControl / NSCell drawing question

2009-09-18 Thread aaron smith
Hey All, quick question. I think this is straight forward, but just wanted some verification before I move forward too far. To keep a long story somewhat short - I have a custom view, which I am placing a custom control into, and am curious if it's proper to specifically be calling the drawRect

Running Safari from application

2009-09-18 Thread Bartosz Białecki
Hi, I try to open local html file in Safari from my application. I use this code: - (void)viewDidLoad { [super viewDidLoad]; username = [[NSUserDefaults standardUserDefaults] stringForKey: @username]; password = [[NSUserDefaults standardUserDefaults] stringForKey: @password];

Re: NSView / NSControl / NSCell drawing question

2009-09-18 Thread aaron smith
nvmind. I got it all figured out. Just by adding the control the a view, it automatically calls the drawing methods. Thanks. On Thu, Sep 17, 2009 at 11:04 PM, aaron smith beingthexemplaryli...@gmail.com wrote: Hey All, quick question. I think this is straight forward, but just wanted some

Handling mouse events in NSCell's?

2009-09-18 Thread aaron smith
What's the proper way of handling simple mouse events in NSCell's? Like mouseUp, mouseDown, etc. I see that an NSControl implements NSResponder, but wasn't sure if that's the right way to do it. Because of the fact that tables usually use cell's rather than a control. I've also been looking at

Re: Handling mouse events in NSCell's?

2009-09-18 Thread Ken Ferry
Hi Aaron, You should take a look at the NSCell docshttp://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSCell_Class/Reference/NSCell.html#//apple_ref/occ/instm/NSCell/trackMouse:inRect:ofView:untilMouseUp: . -Ken trackMouse:inRect:ofView:untilMouseUp:

Re: NSRunLoop issue

2009-09-18 Thread Andreas Grosam
On Sep 17, 2009, at 7:01 PM, Jean-Daniel Dupas wrote: Le 17 sept. 2009 à 18:28, Jerry Krinock a écrit : On 2009 Sep 17, at 07:48, Jean-Daniel Dupas wrote: Add a dummy source (mach port or timer with an insanely high fire date) before running your loop. So you re sure there is at least

Re: Building a 64-bit Preferences Pane

2009-09-18 Thread Jesse Armand
I just realized that the dev forums for Mac is only available for Select or Premier member of ADC, not the online member. Do you mind to share the solution ? Jesse Armand (http://jessearmand.com) 2009/4/30 慧 松本 sato...@mac.com: Thanks!! My problem

init for immutable classes

2009-09-18 Thread Jon Hull
Hello, I am writing a framework which runs on both Snow Leopard and the iPhone (i.e. it is entirely foundation stuff). I always write my init and dealloc methods using the setter functions, but I am wondering what the proper convention is for immutable classes? Should I write a private

Populating TableView Via Button.

2009-09-18 Thread Philip Juel Borges
Hi! Does anyone know how you'd populate a tableview when clicking a button? I tried this: AppController.h: - (void)populateTableView:(id)sender; AppController.m: -(void)populateTableView:(id)sender { [super init]; sourceArray = [NSArray arrayWithObjects:

Re: Populating TableView Via Button.

2009-09-18 Thread I. Savant
On Sep 18, 2009, at 9:34 AM, Philip Juel Borges wrote: Does anyone know how you'd populate a tableview when clicking a button? Nope. That kind of high-tech stuff is beyond any Cocoa developer. ;-) I tried this: -(void)populateTableView:(id)sender { [super init]; ...

Re: +keyPathsForValuesAffectingKey not working for a category-implemented property on a CoreData class

2009-09-18 Thread Doug Knowles
Thanks for the help; all better now. Comments inline. On Thu, Sep 17, 2009 at 12:42 PM, Quincey Morris quinceymor...@earthlink.net wrote: On Sep 17, 2009, at 05:44, Doug Knowles wrote: In a CoreData entity called Topic, I have a to-many relationship (to other Topics) called children to

Re: Populating TableView Via Button.

2009-09-18 Thread Sean Kline
Would an alternative implementation be to have the button click swap in a view with a NSTableView bound to its data source? -S On Fri, Sep 18, 2009 at 9:34 AM, Philip Juel Borges philipjbor...@gmail.com wrote: Hi! Does anyone know how you'd populate a tableview when clicking a button? I

If someone could inspect this code and explain to me what am I doing wrong ?

2009-09-18 Thread Mario Kušnjer
Hello to the list ! As the title say, I could use home help. I'm still on the learning path. This code is attempt of implementing a Leopard style source list using a NSOutlineView. Code provided below works but as seen from the console output of NSLog's it displays come cell's number of

Re: init for immutable classes

2009-09-18 Thread Kyle Sluder
On Sep 18, 2009, at 4:10 AM, Jon Hull jh...@gbis.com wrote: I always write my init and dealloc methods using the setter functions, but I am wondering what the proper convention is for immutable classes? Should I write a private setter method, or is it ok to just set the variable in init

Re: Running Safari from application

2009-09-18 Thread Uli Kusterer
On 18.09.2009, at 10:26, Bartosz Białecki wrote: The problem is that the safari is not launched. If I put in showPageInSafari function openURL: [NSURL URLWithString: @http://www.example.com/index.php;] then it works. Do you know what is wrong? Could it be that the path is not accessible for

Re: init for immutable classes

2009-09-18 Thread Uli Kusterer
On 18.09.2009, at 13:10, Jon Hull wrote: I am writing a framework which runs on both Snow Leopard and the iPhone (i.e. it is entirely foundation stuff). I always write my init and dealloc methods using the setter functions, but I am wondering what the proper convention is for immutable

CalCalendarStore Breaking a Recurring Event

2009-09-18 Thread Brad Goss
Hello everyone, I've encountered a bug/limitation with the CalCalendarStore. The situation in a nutshell: 1) Add an event with a recurrenceRule repeating everyday for 2 days. 2) Delete the first event (could be either) 3) Now try to undo the users action by inserting the event back in.

Reliable way to find out if CoreData finished loading

2009-09-18 Thread Mantas Masalskis
Hi, I'm loading Core Data object via Managed Object Context in IB. It looks like it hasn't finished loading when applicationDidFinishLoading is fired. What is the appropriate way to do smth once Managed Object Context is loaded? Mantas Masalskis

2 simple questions

2009-09-18 Thread Kennedy Kok
1. How do I programmatically open a folder window? And open a webpage using the default browser? 2. How do I change the icon for a folder I have created programmatically? How do I get it to list it under Places (on the left of the Finder window) programmatically? Thanks K

Re: Building a 64-bit Preferences Pane

2009-09-18 Thread Jesse Armand
Okay thanks, I also found the solution from a blog somewhere while searching. It's weird how Apple lay out all of the important things about 64-bit in the docs, but left out this one somewhere that I couldn't find easily. I also ran the script to check for 64-bit compatibility, added the proper

Re: 2 simple questions

2009-09-18 Thread Uli Kusterer
Hi Kennedy, let me introduce you to a brand-new tool called Google. You can find it at http://www.google.com and you type in your questions, and generally the first to third items in the replies it gives you tell you exactly how to solve your problem. For those questions where I easily

Re: Reliable way to find out if CoreData finished loading

2009-09-18 Thread Sean Kline
Hi Mantas, What are you trying to do? - S On Thu, Sep 17, 2009 at 6:46 PM, Mantas Masalskis man...@idev.lt wrote: Hi, I'm loading Core Data object via Managed Object Context in IB. It looks like it hasn't finished loading when applicationDidFinishLoading is fired. What is the appropriate

Re: Reliable way to find out if CoreData finished loading

2009-09-18 Thread I. Savant
On Sep 17, 2009, at 6:46 PM, Mantas Masalskis wrote: I'm loading Core Data object via Managed Object Context in IB. It looks like it hasn't finished loading when applicationDidFinishLoading is fired. Perhaps thinking about this a different way would clarify things. You don't load a

Re: Building a 64-bit Preferences Pane

2009-09-18 Thread Kyle Sluder
On Sep 18, 2009, at 9:01 AM, Jesse Armand mnemonic...@gmail.com wrote: It's weird how Apple lay out all of the important things about 64-bit in the docs, but left out this one somewhere that I couldn't find easily. Garbage collection and 64-bit are orthogonal issues. A process can be one,

Re: Handling mouse events in NSCell's?

2009-09-18 Thread Raleigh Ledet
I agree with Ken and strongly encourage you to use the three tracking methods already defined in the NSCell documentation raleigh. On Sep 18, 2009, at 2:12 AM, Ken Ferry wrote: Hi Aaron, You should take a look at the NSCell

Re: Printing with Snow Leopard

2009-09-18 Thread Raleigh Ledet
Hi Gerriet, You are printing the same instance of a view that is in your UI. So basically, your are trying to get the same view to print on two threads. Unless your view can handle concurrent drawing, this could be bad. NSTextView doesn't support concurrent drawing. I think you were

Re: If someone could inspect this code and explain to me what am I doing wrong ?

2009-09-18 Thread Quincey Morris
On Sep 18, 2009, at 07:52, Mario Kušnjer wrote: This code is attempt of implementing a Leopard style source list using a NSOutlineView. Code provided below works but as seen from the console output of NSLog's it displays come cell's number of times which probably means that my implementation

Re: Populating TableView Via Button.

2009-09-18 Thread Volker in Lists
Hi, best solution would be to update the datasource... Swapping views just for the sake of displaying new data is not something one should do. Have you read up on how to implement a datasource for NSTableView? Maybe you try to follow this old, but still useful tutorial:

What is the life of the c string returned by NSString's UTF8String method?

2009-09-18 Thread Stuart Malin
I am under the impression that the reference returned by NSString's UTF8String method is valid for the life of the NSString instance which provided the reference (and further, that the memory of the referenced C string is freed when the NSString is released). Is this correct? I have a

Re: Menu shortcuts without modifiers?

2009-09-18 Thread Uli Kusterer
On 17.09.2009, at 22:26, Ashley Clark wrote: Have you tried looking at the menuHasKeyEquivalent:forEvent:target:action: delegate method on NSMenu? I suppose you could examine the firstResponder status and other state and return NO if you don't want the key to be handled as a key

Re: Running Safari from application

2009-09-18 Thread Uli Kusterer
On 18.09.2009, at 18:52, Bartosz Białecki wrote: I think so too. So do you know maybe another solution how to open local html file with Safari? No. But you could always use a web view instead? Or maybe there's some sort of shared folder somewhere? Cheers, -- Uli Kusterer The witnesses

Re: What is the life of the c string returned by NSString's UTF8String method?

2009-09-18 Thread Jesper Storm Bache
On Sep 18, 2009, at 11:04 AM, Stuart Malin wrote: I am under the impression that the reference returned by NSString's UTF8String method is valid for the life of the NSString instance which provided the reference (and further, that the memory of the referenced C string is freed when the

Re: What is the life of the c string returned by NSString's UTF8String method?

2009-09-18 Thread Sean McBride
On 9/18/09 2:04 PM, Stuart Malin said: I have a class with some (statically allocated) class variables. In the class's -initialize method, I create a retained NSString. I set one of the class variables to the value returned by -UTF8String (as sent to that retained NSString). I use this char*

Re: What is the life of the c string returned by NSString's UTF8String method?

2009-09-18 Thread Jens Alfke
On Sep 18, 2009, at 11:04 AM, Stuart Malin wrote: I am under the impression that the reference returned by NSString's UTF8String method is valid for the life of the NSString instance which provided the reference (and further, that the memory of the referenced C string is freed when the

Re: Running Safari from application

2009-09-18 Thread Jens Alfke
On 18.09.2009, at 18:52, Bartosz Białecki wrote: I think so too. So do you know maybe another solution how to open local html file with Safari? You could encode the entire HTML file in a 'data:' URL, if it's not too huge. (You'd have to do the same thing to any custom image: convert it

Re: Finding user's Music folder (and others)?

2009-09-18 Thread Jens Alfke
On Sep 17, 2009, at 9:32 PM, Graham Cox wrote: It's also pretty common to relocate it - don't assume it's unusual. Quite a few people like to keep their music on an external drive so whatever it is you're doing, if you assume ~/Music/, it'll fail in those cases, as you realise. Yes!

Re: What is the life of the c string returned by NSString's UTF8String method?

2009-09-18 Thread Stuart Malin
On Sep 18, 2009, at 2:20 PM, Sean McBride wrote: On 9/18/09 2:04 PM, Stuart Malin said: I have a class with some (statically allocated) class variables. In the class's -initialize method, I create a retained NSString. I set one of the class variables to the value returned by -UTF8String (as

Re: What is the life of the c string returned by NSString's UTF8String method?

2009-09-18 Thread Nick Zitzmann
On Sep 18, 2009, at 12:04 PM, Stuart Malin wrote: I am under the impression that the reference returned by NSString's UTF8String method is valid for the life of the NSString instance which provided the reference (and further, that the memory of the referenced C string is freed when the

Re: Handling mouse events in NSCell's?

2009-09-18 Thread aaron smith
Ken, Yeah I read the docs. I can't figure out how to get the -stopTracking:at:inView:mouseIsUp: method to fire. Should I just be able to define that method and receive use that method when the mouse is up? Or do I have to use a combination of the mouse tracking methods available. I've tried both

Re: Crash on SL in com.apple.DesktopServices after using NSOpenPanel

2009-09-18 Thread Lucien W. Dupont
On Tue, Sep 8, 2009 at 7:53 AM, Corbin Dunn corb...@apple.com wrote: On Sep 7, 2009, at 5:25 AM, Markus Spoettl wrote: On Sep 7, 2009, at 1:31 PM, Thomas Clement wrote: Looks like an Apple bug. http://kb2.adobe.com/cps/506/cpsid_50654.html That doesn't seem to be the problem with that

Re: What is the life of the c string returned by NSString's UTF8String method?

2009-09-18 Thread Jean-Daniel Dupas
Le 18 sept. 2009 à 20:20, Nick Zitzmann a écrit : On Sep 18, 2009, at 12:04 PM, Stuart Malin wrote: I am under the impression that the reference returned by NSString's UTF8String method is valid for the life of the NSString instance which provided the reference (and further, that the

getting accessor method info in a different class.

2009-09-18 Thread jon
In one class, I have set webView up like this... which works fine, but i want to have access to this pointer from another class... i am not getting something correct here, it gives me warning: WebView may not respond to webView i'll just include the relevant code. what am i not

Re: What is the life of the c string returned by NSString's UTF8String method?

2009-09-18 Thread Wade Tregaskis
Or to avoid a copy and raw memory management, you can also query directly an NSData from the string using -[NSString dataUsingEncoding:NSUTF8StringEncoding] and then use -[NSData bytes] as the returned value for this method is guarantee to have the same life as the NSData object. Though

Problem with fontDescriptorWithFontAttributes:

2009-09-18 Thread Laurent Daudelin
Not sure if it's a known issue but given this: currentFontDescriptor = [NSFontDescriptor fontDescriptorWithFontAttributes:fontAttributes]; NSFont *fontToUse = [NSFont fontWithDescriptor:currentFontDescriptor size:[[self font] pointSize]]; I'm getting this in the debugger: (gdb) po

Re: Menu shortcuts without modifiers?

2009-09-18 Thread Peter Ammon
On Sep 17, 2009, at 12:29 PM, Uli Kusterer wrote: Hi, I have an app that contains a QTMovieView. I've set things up so people can use the arrow keys to skip, fast forward, rewind, use space to play/pause etc., as they're used to from other movie- playing apps. Now, I'd like to add menu

access to object from a different class

2009-09-18 Thread jon
Ok, I did not get the desired result, but i am a little closer, I'm going to set this up again. below is example code to set up the circumstance, so you better see what i want to do. (stripped down to what i am trying to find out) (webView is hooked up in IB to a WebView object) (i

Re: getting accessor method info in a different class.

2009-09-18 Thread Greg Guerin
jon wrote: In one class, I have set webView up like this... which works fine, but i want to have access to this pointer from another class... i am not getting something correct here, it gives me warning: WebView may not respond to webView i'll just include the relevant code. what am i not

iPhone Segmentation Fault

2009-09-18 Thread Bob Barnes
all, My iPhone app is reporting a segmentation fault when terminating (only on the real device, not in the simulator) and also reporting a bad file descriptor. Anyone have any idea what the message is trying to tell me or how to find out. It occurs after the call to dealloc has completed.

Re: access to object from a different class

2009-09-18 Thread jon
Added info: i would try this: theWebView = [aController webView];except that the aController is new, and not pointing to the thing i want, the first webView's pointer to it's object instance... Jon. ___ Cocoa-dev mailing list

Re: Crash on SL in com.apple.DesktopServices after using NSOpenPanel

2009-09-18 Thread Markus Spoettl
On Sep 18, 2009, at 10:30 PM, Lucien W. Dupont wrote: On Tue, Sep 8, 2009 at 7:53 AM, Corbin Dunn corb...@apple.com wrote: On Sep 7, 2009, at 5:25 AM, Markus Spoettl wrote: On Sep 7, 2009, at 1:31 PM, Thomas Clement wrote: Looks like an Apple bug.

Re: iPhone Segmentation Fault

2009-09-18 Thread Bob Barnes
Bill, No crash log, just some console messages. Fri Sep 18 15:17:42 unknown com.apple.launchd[1] Notice: (UIKitApplication:com..[0x2e72]) Bug: launchd_core_logic.c:2649 (23909):10 Fri Sep 18 15:17:42 unknown com.apple.launchd[1] Notice:

Re: If someone could inspect this code and explain to me what am I doing wrong ?

2009-09-18 Thread Mario Kušnjer
On 2009.09.18, at 19:54, Quincey Morris wrote: It's not clear what you think is wrong. Data source methods may be called (in general) any number of times at any time. If you think the NSLog output shows something wrong, post an example here. Hi again ! I am posting NSLog output and I

transition through black

2009-09-18 Thread Erik Colson
hello, I want to create a CATransition for transition as follows : first, fade to black second fade to new image How should I do this ? -- erik ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator

Re: transition through black

2009-09-18 Thread Erik Colson
On 19 Sep 2009, at 01:15, Christopher Kemsley wrote: CAKeyframeAnimation Have three keyframes: 1) original image 2) black image (from CGBitmapContext and CGFillRect... etc) 3) new image hmmm... that might be a solution... however I was thinking about using CIFilter with CATransition for

Re: If someone could inspect this code and explain to me what am I doing wrong ?

2009-09-18 Thread Charles Srstka
On Sep 18, 2009, at 5:26 PM, Mario Kušnjer wrote: This is slow while expanding and collapsing. Maybe because it is writing to the NSLog ? Well, did you try commenting out the logs and see if that reduces the slowness? Charles___ Cocoa-dev

Static Analyzer and Core Foundation

2009-09-18 Thread Steve Cronin
Folks; Alert - potential boneheaded-ness lies ahead - please be gentle. I'll be the first to admit that I'm much happier in ObjC than C… I thought I would try static analysis and see what turned up. On the whole I must say I'm pleased but this one has me questioning my basic understanding

Re: Static Analyzer and Core Foundation

2009-09-18 Thread Luke the Hiesterman
Line 44 creates 2 objects, one goes into the dictRef, the other is not assigned to a variable, but is used only as the second argument to MDItemCopyAttributes. The object that you create inside that call is never released. Luke On Sep 18, 2009, at 4:33 PM, Steve Cronin wrote: Folks;

Re: Static Analyzer and Core Foundation

2009-09-18 Thread Steve Cronin
Luke; OK thank-you for that answer to question 2! Any thoughts on question 1? Steve On Sep 18, 2009, at 6:36 PM, Luke the Hiesterman wrote: Line 44 creates 2 objects, one goes into the dictRef, the other is not assigned to a variable, but is used only as the second argument to

Re: Static Analyzer and Core Foundation

2009-09-18 Thread Chris Parker
On 18 Sep 2009, at 4:33 PM, Steve Cronin wrote: Alert - potential boneheaded-ness lies ahead - please be gentle. I'll be the first to admit that I'm much happier in ObjC than C… I thought I would try static analysis and see what turned up. On the whole I must say I'm pleased but this one has

Re: Static Analyzer and Core Foundation

2009-09-18 Thread Luke the Hiesterman
There's not enough code here to give a good answer to question 1. Luke On Sep 18, 2009, at 4:39 PM, Steve Cronin wrote: Luke; OK thank-you for that answer to question 2! Any thoughts on question 1? Steve On Sep 18, 2009, at 6:36 PM, Luke the Hiesterman wrote: Line 44 creates 2 objects,

Re: Static Analyzer and Core Foundation

2009-09-18 Thread Steve Cronin
Luke; I've adapted the code to accomodate your's and Chris' answer to question 2. Here's the entire method, which now shows not static analyzer issues but I still would like to understand why not. + (NSDictionary *)metadataForFilePath:(NSString *)thisPath { NSDictionary *md =

Re: NSString vs. encoding

2009-09-18 Thread Johan Kool
Op 17 sep 2009, om 22:29 heeft Andrew Farmer het volgende geschreven: On 16 Sep 2009, at 22:55, Johan Kool wrote: Thanks so much!! That is indeed the case! I now use strunvis and it's all done in just 4 lines of code. (Well, except that I should still handle a returned error code.) int

Re: If someone could inspect this code and explain to me what am I doing wrong ?

2009-09-18 Thread Quincey Morris
On Sep 18, 2009, at 15:26, Mario Kušnjer wrote: 2009-09-18 22:20:59.174 LSOutline[244:10b] 4 - item for key nameOfShow is NEWS AT 10 --- and here of the second item. 2009-09-18 22:20:59.380 LSOutline[244:10b] 4 - item for key nameOfShow is NEWS AT 6 --- So why is it called again here for

Re: If someone could inspect this code and explain to me what am I doing wrong ?

2009-09-18 Thread Graham Cox
On 19/09/2009, at 8:26 AM, Mario Kušnjer wrote: Maybe because it is writing to the NSLog ? Almost certainly. There's no other obvious bottleneck in your code, but logging is quite slow, and if done during any kind of drawing, will really be noticeable. A table/outline's data source is

Printing to NSData

2009-09-18 Thread Gerriet M. Denkmann
I am doing: NSPrintOperation *po = [ NSPrintOperation printOperationWithView: textView printInfo: printInfo ]; ... PDFDocument *pdfFile = [ [ PDFDocument alloc ] initWithURL: pdfUrl ]; ... do some post-processing here Works fine, but looks rather inefficient, as file-IO is probably the

Re: Printing with Snow Leopard

2009-09-18 Thread Gerriet M. Denkmann
On 19 Sep 2009, at 00:36, Raleigh Ledet wrote: You are printing the same instance of a view that is in your UI. So basically, your are trying to get the same view to print on two threads. Unless your view can handle concurrent drawing, this could be bad. NSTextView doesn't support

How to show the Info Panel for the files in tableview?

2009-09-18 Thread James
Hi all, My application is a movie player that similar to iTunes. Now, the result i want are as follows... If I right-click a movie file in the table view and select the info menu item, I expect it can display the Info Panel of the file. Now, the contextual menu is accomplished. But, how

Re: How to show the Info Panel for the files in tableview?

2009-09-18 Thread Graham Cox
On 19/09/2009, at 2:17 PM, James wrote: Now, the contextual menu is accomplished. But, how can I display the Info Panel? The question is a bit too broad - break it down. This is the same as displaying any window/dialog/sheet. Try starting with the documentation for NSWindow and

Re: Optimizing Enormous lists in NSBrowser

2009-09-18 Thread Jens Alfke
On Sep 17, 2009, at 2:32 PM, Dave DeLong wrote: For normal-sized directories, this works pretty well. However, in my worst-case scenario of a flat directory containing 1 million files, I've found that it takes 34.8 seconds to retrieve a full directory listing (so I know how many to

Re: Static Analyzer and Core Foundation

2009-09-18 Thread Jens Alfke
On Sep 18, 2009, at 5:25 PM, Steve Cronin wrote: Is this the 'best' this can be? You need to call CFRelease on 'mdi', right after releasing 'arrayRef'. I don't know why the analyzer isn't reporting that as a leak — you could file a bug report.