KVO and Object Arrays

2008-04-19 Thread Jake Carter
Hey guys, I have a KVO question. First, the setup: Foo NSMutableArray *bars; Bar NSString *name; int number; AppDelegate NSMutableArray *foos; So the AppDelegate will contain an array of Foo object and each Foo object will have an array of Bar objects. I want to be able to obser

Re: Binding NSButton enabled state

2008-04-19 Thread Chris Hanson
On Apr 19, 2008, at 11:08 AM, Lorenzo Thurman wrote: I have two NSTableViews, tableA and tableB, each managed by separate NSArrayControllers. When a selection is made in either table, an instance variable is set. I want to have an NSButton's enabled state to 'YES' whenever the instance variab

Re: NSPopupButton Bindings

2008-04-19 Thread Steve Weller
On Apr 19, 2008, at 5:58 PM, Johnny Lundy wrote: Good evening, I am having trouble understanding the bindings for NSPopupButton. View: NSPopupButton Controller: NSArrayController, just for the popup button Model: NSMutableArray of NSMutableDictionaries. I have the array controller bound to

Re: Get list of possible applications

2008-04-19 Thread Chris Hanson
On Apr 19, 2008, at 9:55 AM, Gerd Knops wrote: This returns an array with URLs of applicable applications for a file of a given URL: - (NSArray *)applicationsForURL:(NSURL *)url { return (NSArray *)LSCopyApplicationURLsForURL((CFURLRef)url,kLSRolesAll); } It also leaks -- even i

Re: NSKeyedArchiver and Forwards Compatibility Strategies

2008-04-19 Thread Graham Cox
I have run into the same issues - in my case I can always convert a subclass back to a superclass that is usable, but I don't see a problem with your keyed archiver delegate returning an NSNull object for classes it doesn't know about, or even just nil. You'll need to experiment to see if N

Re: horizontal sizeToFit of NSTextView or NSTextField

2008-04-19 Thread Jack Repenning
On Apr 19, 2008, at 8:31 AM, Manfred Schwind wrote: Now I want to be able to calculate the optimal width of the view so that the entire text is visible. This worked wonders for me: http://www.cocoabuilder.com/archive/message/cocoa/2008/3/31/202752 -==- Jack Repenning [EMAIL PROTECTED] Proj

Re: drawRect: called twice for NSView subclass.

2008-04-19 Thread Scott Thompson
On Apr 19, 2008, at 7:15 PM, William Hunt wrote: Essentially I have a window with a custom view atop a button. What happens at each refresh, however, is that the custom view's drawRect: is called twice. First it is called with the whole window's NSRect, then it is called with the "proper"

Re: presentError:

2008-04-19 Thread Quincey Morris
On Apr 19, 2008, at 15:36, Ali Ozer wrote: (3) According to the NSResponder class reference, a responder passes presentError to the next error responder and: "if there is no next responder, it passes the error object to NSApp, which displays a document-modal error alert" I had hoped this

Re: Implementing a Slightly Unusual NSTableView

2008-04-19 Thread Graham Cox
Hi Peter, I have solved this problem in the past (under Tiger, same code still works fine on Leopard) and here's what I did - it may not be completely generic but it but should give you the general idea. There might be an easier/cleaner/better way to do it, but it did the trick for me. On

NSPopupButton Bindings

2008-04-19 Thread Johnny Lundy
Good evening, I am having trouble understanding the bindings for NSPopupButton. View: NSPopupButton Controller: NSArrayController, just for the popup button Model: NSMutableArray of NSMutableDictionaries. I have the array controller bound to the array in the model, and that is working fine.

Re: [SOLVED] Simulating menu bar blink in Cocoa

2008-04-19 Thread John Stiles
Could you do something else to cause VoiceOver to explicitly say the string you want it to? Martin Wierschin wrote: The "fake temporary item" solution actually works pretty well. It's the last thing I'd call elegant, but here's how you can blink a menu title in Cocoa. Unfortunately that solu

Re: Simulating menu bar blink in Cocoa

2008-04-19 Thread John Stiles
No, that's not the problem. The problem is that some combinations simply don't work. For instance, just as a random example, AppKit does not match "option+," or "shift+`". (Haven't tried adding command but offhand I don't have any reason to think that this would fix it.) My app supports arbitr

drawRect: called twice for NSView subclass.

2008-04-19 Thread William Hunt
Ok, it's been a while since I've bugged you guys, so I thought I'd get back into the fold. Note that I'm very new to graphics programming in general, and even more so for Cocoa. So be prepared for an easy fix! Anyway, the problem I have is this. +--+ |++| |

Re: max # of file handles

2008-04-19 Thread j o a r
On Apr 18, 2008, at 1:00 PM, Wesley Smith wrote: I'm trying to debug a Cocoa app that occasionally exceeds the max allowable number of file handles open and I'm wondering if there's a way to query how many are actually open. I haven't found anything in the docs. Does anyone know where I might

Re: max # of file handles

2008-04-19 Thread Scott Ribe
> I'm trying to debug a Cocoa app that occasionally exceeds the max > allowable number of file handles open and I'm wondering if there's a > way to query how many are actually open. I haven't found anything in > the docs. Does anyone know where I might find a reference to such a > function? I do

Re: Should a Method set NSError* to nil when No Error?

2008-04-19 Thread Uli Kusterer
Am 19.04.2008 um 18:46 schrieb Jerry Krinock: I often write methods that take an (NSError**)error_p argument. In the documentation of Apple methods that do this, I read that the NSError** will be set if there ^is^ an error, but most do not specify what will happen if there is ^not^. Wel

Re: max # of file handles

2008-04-19 Thread Jonathan del Strother
On Fri, Apr 18, 2008 at 9:00 PM, Wesley Smith <[EMAIL PROTECTED]> wrote: > I'm trying to debug a Cocoa app that occasionally exceeds the max > allowable number of file handles open and I'm wondering if there's a > way to query how many are actually open. I haven't found anything in > the docs.

Popups and NSDictionaryController

2008-04-19 Thread Gordon Apple
I have been trying my best to bind a popup menu to a Dictionary using NSDictionaryController. So far, no go. I have been able to bind the popup to a separate NSArray of keys using NSArrayCntroller, but have been unable to bind to a dictionary having the same key list using NSDictionaryControl

max # of file handles

2008-04-19 Thread Wesley Smith
I'm trying to debug a Cocoa app that occasionally exceeds the max allowable number of file handles open and I'm wondering if there's a way to query how many are actually open. I haven't found anything in the docs. Does anyone know where I might find a reference to such a function? thanks, wes __

Re: presentError:

2008-04-19 Thread Ali Ozer
"In rare cases, you may want to display a caution icon in your alert, badged with the application icon as shown in Figure 14-48. A badged alert is appropriate only if the user is performing a task, such as installing software, and a possible side effect of that task would be the inadvertent

Re: Should a Method set NSError* to nil when No Error?

2008-04-19 Thread Ali Ozer
#define SSYInitErrorP(_error_p) NSError* dummyError ; \ if (_error_p == NULL) { \ _error_p = &dummyError ; \ } \ * _error_p = nil ; I use it like this, with an (NSError**)error_p: SSYInitErrorP(error_p) Besides setting *error_p to nil, which we agree is not necessary but I "just like",

Re: Simulating menu bar blink in Cocoa

2008-04-19 Thread Benjamin Stiglitz
If I understand well, your trying to catch event that match a menu item shortcut minus the shift key. Isn't it possible to override - [NSApp sendEvent:] as you did, but instead of taking care of the event yourself, create a new event that match the menu item and then call super with this new

Getting the correct objectValue in NSCell in NSTableView

2008-04-19 Thread Ferhat Ayaz
Hi, I'm implementing the following method in NSActionCell's subclass which I'm using for NSTableColumn dataCell. - (BOOL)trackMouse:(NSEvent*)theEvent inRect:(NSRect)cellFrame ofView:(NSView*)controlView untilMouseUp:(BOOL)flag { NSPoint locationInCell;

Re: presentError:

2008-04-19 Thread Jerry Krinock
On 2008 Apr, 19, at 12:47, Quincey Morris wrote: Before I radar these as bugs, I though I'd see if anyone has any comments. Maybe I misunderstand something. I agree that these are all bugs, and appreciate you taking the time to list them. Personally, I abandoned the various -presentAlert.

Re: Should a Method set NSError* to nil when No Error?

2008-04-19 Thread Jerry Krinock
On 2008 Apr, 19, at 11:24, Bill Bumgarner wrote: If there is no error -- if the return value is set and valid -- then the behavior regarding the (NSError**) argument is undefined. Agreed, although not the way I would have designed it. Any caller relying upon the value to be...unchanged...is

presentError:

2008-04-19 Thread Quincey Morris
(1) The HIG guidelines say, regarding alert icons: "In rare cases, you may want to display a caution icon in your alert, badged with the application icon as shown in Figure 14-48. A badged alert is appropriate only if the user is performing a task, such as installing software, and a possibl

NSKeyedArchiver and Forwards Compatibility Strategies

2008-04-19 Thread Colin Cornaby
I have an array of objects. The objects are all subclasses of one parent class. (For the sake of this email, I will say that the subclasses are all different kinds of graphics that can be displayed, and the superclass defines generalities that all graphics have in common.) My concern here

NSSlider value same from last mouse tracking to mouse up action?

2008-04-19 Thread Scott Lehman
I have an NSSlider set to send its action on both mouse tracking and mouse up. Is there any guarantee that the value of the slider doesn't change between the time the last mouse tracking action and the mouse up action? In testing, it appears to be that way, but I can't find anything in the docs

Re: Should a Method set NSError* to nil when No Error?

2008-04-19 Thread Bill Bumgarner
On Apr 19, 2008, at 11:46 AM, Jerry Krinock wrote: I often write methods that take an (NSError**)error_p argument. In the documentation of Apple methods that do this, I read that the NSError** will be set if there ^is^ an error, but most do not specify what will happen if there is ^not^.

Binding NSButton enabled state

2008-04-19 Thread Lorenzo Thurman
I have two NSTableViews, tableA and tableB, each managed by separate NSArrayControllers. When a selection is made in either table, an instance variable is set. I want to have an NSButton's enabled state to 'YES' whenever the instance variable is set. I've tried binding the button to the instance va

Re: Subclassing

2008-04-19 Thread Dave Howell
On Apr 18, 2008, at 5:54 PM, Jack Repenning <[EMAIL PROTECTED]> wrote: On Apr 18, 2008, at 2:56 PM, K. Darcy Otto wrote: I want to subclass Dependency and override a few things. Can I do this without modifying DeductionLine? Perhaps you want to create a category instead? That allows yo

Re: Get list of possible applications

2008-04-19 Thread Gerd Knops
On Apr 19, 2008, at 11:03 AM, Daniel wrote: Hi to all, is there a way to query all the possible applications (the one which is shown in the list "Open With") of a specific file from Cocoa? This returns an array with URLs of applicable applications for a file of a given URL: - (NSArray *)ap

Should a Method set NSError* to nil when No Error?

2008-04-19 Thread Jerry Krinock
I often write methods that take an (NSError**)error_p argument. In the documentation of Apple methods that do this, I read that the NSError** will be set if there ^is^ an error, but most do not specify what will happen if there is ^not^. When there is no error, if I'm provided a non-NULL e

Get list of possible applications

2008-04-19 Thread Daniel
Hi to all, is there a way to query all the possible applications (the one which is shown in the list "Open With") of a specific file from Cocoa? Thanks in advance, Daniel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin

horizontal sizeToFit of NSTextView or NSTextField

2008-04-19 Thread Manfred Schwind
I have a view that has a fixed height and that should be filled with text (at runtime, but the text keeps static once set). Now I want to be able to calculate the optimal width of the view so that the entire text is visible. The text may wrap around. I tried a zillion things with NSTextView a

Re: Delete NSDefaults while running

2008-04-19 Thread Jens Alfke
On 19 Apr '08, at 8:04 AM, Kevin Grant wrote: [[[NSUserDefaults alloc] init] removePersistentDomainForName:@"com.yourdomain.yourapp"]; I think that should work. To be safe, call [[NSUserDefaults standardUserDefaults] synchronize]; first; otherwise if there are any unsaved changes

Re: Implementing a Slightly Unusual NSTableView

2008-04-19 Thread Jens Alfke
On 19 Apr '08, at 3:05 AM, Peter Zegelin wrote: However as things currently are, every time a checkbox is clicked on the row is selected as well, and the focus is shifted away from my drawing view to this tableview. What I would really like to happen is that if a user clicks on a checkbox

Re: running out of NSPipes

2008-04-19 Thread Jens Alfke
I think what's missing is a call to [handle closeFile]. From the NSFileHandle docs: Sending closeFile to a file handle does not cause its deallocation. Deallocation of a file handle deletes its descriptor and closes the represented file or channel only if the handle was created usinginitW

Re: Delete NSDefaults while running

2008-04-19 Thread Kevin Grant
I've used this to delete preferences file before: [[[NSUserDefaults alloc] init] removePersistentDomainForName:@"com.yourdomain.yourapp"]; Although I've only used it with side domains I'd created, I'm not sure if it works for *the* main preferences file. Kevin G. Hi, How would one go

Re: Subclassing

2008-04-19 Thread Manfred Schwind
I am working on a program with a complex hierarchy of classes, and I want to subclass one of the objects a few steps down on that hierarchy. Do I have to create a parallel hierarchy to do this? Here is the problem: AppController instantiates a Deduction object. The Deduction object instan

Re: IKImageBrowserView spacing and contextual menus

2008-04-19 Thread thomas goossens
Hi Yann, On Apr 19, 2008, at 10:51 AM, Yann Disser wrote: Is there a way to change the spacing of the images in an IKImageBrowserView? In InterfaceBuilder? No, the only thing you can do to impact the cell-spacing is to use setCellSize and give a non square size (a size taller than larger=>

Delete NSDefaults while running

2008-04-19 Thread Andrew James
Hi, How would one go about deleting the preference file of a running application while in the application? or is there a way to run a application/command and then relaunch the application after its all completed? The main purpose is i want one of my programs to be more self repairing an

Re: Simulating menu bar blink in Cocoa

2008-04-19 Thread Jean-Daniel Dupas
Le 19 avr. 08 à 06:36, Benjamin Stiglitz a écrit : As previously explained here, I'm handling hotkeys in my app via custom code in order to work around some AppKit bugs. How can I simulate the menu-title blink effect using Cocoa? In Carbon, it's FlashMenuBar(menuID) but I don't see a Cocoa

Re: Capsule-Style Toolbar Controls

2008-04-19 Thread Stefan Hafeneger
Okay, thanks for your help Peter. With best wishes, Stefan Am 19.04.2008 um 01:04 schrieb Peter Ammon: Yes, in Leopard, unified and non-unified windows are the same except for some minor differences in the toolbar metrics, which you found. :) The metric differences were left in for compa

Implementing a Slightly Unusual NSTableView

2008-04-19 Thread Peter Zegelin
I have a tableview representing the layers of a drawing application. The tableview has several columns of checkboxes, some status columns and an editable text column for the layer name. The rows of the tableview are selectable (multiple selection) so they can be reordered and cut, copied a

IKImageBrowserView spacing and contextual menus

2008-04-19 Thread Yann Disser
Is there a way to change the spacing of the images in an IKImageBrowserView? In InterfaceBuilder? How can I assign a right-click menu/contextual menu to an image browser view? Connection a NSMenu with the menu-outlet in InterfaceBuilder works for all of my views except the IKImageBrowserV

Re: running out of NSPipes

2008-04-19 Thread Bob Smith
On Apr 18, 2008, at 9:58 PM, justin webster wrote: I'm pretty sure I've got all objects alloc'd and released correctly. this example is the broken one: - (NSString *)myShellFunction:(NSString *)PID { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSTask *ps=[[NSTask