• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSOpenPanel Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOpenPanel Question


  • Subject: Re: NSOpenPanel Question
  • From: Ed Friese <email@hidden>
  • Date: Sat, 8 Mar 2003 20:31:57 -0800

Well, I managed to get something working. I subclassed NSOpenPanel and
added this method which is called right after creating the open panel:

- (void)setupBrowser
{
[[SamplePreviewer sharedInstance] setBrowserActions:_browser];
}

SamplePreviewer is the controller for my custom accessory view.
SamplePreviewer:setBrowserActions does this:

- (void)setBrowserActions:(NSBrowser*)browser
{
oldBrowserTarget = [browser target];
oldBrowserAction = [browser action];
oldBrowserDoubleAction = [browser doubleAction];

[browser setTarget: self];
[browser setAction: @selector(browserAction:)];
[browser setDoubleAction: @selector(browserDoubleAction:)];
}

Finally, the browserAction and browserDoubleAction are as follows:

- (IBAction)browserAction:(id)sender
{
[oldBrowserTarget performSelector:oldBrowserAction];

NSBrowser* p_browser = (NSBrowser*)sender;
NSString* p_path = [p_browser path];
NSLog(p_path);
}

- (IBAction)browserDoubleAction:(id)sender
{
[oldBrowserTarget performSelector:oldBrowserDoubleAction];

NSBrowser* p_browser = (NSBrowser*)sender;
NSString* p_path = [p_browser path];
NSLog(p_path);
}

This seems *really* ugly to me, but it actually works. I'd love to
hear any comments people might have about this (although I'd rather see
Apple just fix it so I don't have to do all this crap.

Ed

On Wednesday, February 26, 2003, at 02:43 PM, Ed Friese wrote:

> hmm. i've looked through all the documentation I can find on the open
> panel and all its parent classes and still can't find a method that
> looks appropriate for this. is the lack of responses because it's
> just not possible? The only thing I can think of at this point is to
> trap a low-level mouse event or just poll the current selection. both
> of these seem incredibly hackish to me. am i missing something
> obvious?
>
> ed
>
> On Tuesday, February 25, 2003, at 01:45 AM, Ed Friese wrote:
>
>> I've got an accessory view that I'd like to update with some info
>> about the currently selected file(s) in an NSOpenPanel. Ideally my
>> object would get a message every time the selection changes in the
>> panel and I would just scan the selected file to update the accessory
>> view. Is there a method I can override to figure out when the
>> selection has changed in the open panel, or is there another way I'm
>> supposed to do this? I'm just getting the hang of this objective-c
>> stuff so I'm not quite sure what the proper technique is here.
>>
>> thanks,
>> ed
>> _______________________________________________
>> cocoa-dev mailing list | email@hidden
>> Help/Unsubscribe/Archives:
>> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>> Do not post admin requests to the list. They will be ignored.
> _______________________________________________
> cocoa-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Detecting when a window has been drawn...
  • Next by Date: Trying to connect my Controller Class to my Model Class
  • Previous by thread: Re: Detecting when a window has been drawn...
  • Next by thread: Trying to connect my Controller Class to my Model Class
  • Index(es):
    • Date
    • Thread