Ask a Question related to Mac Programming, Design and Development.
-
Loic BERTRAND #1
NSOpenPanel question
Hi,
I am a newbie programming a Cocoa app. I read in
[url]http://developer.apple.com/documentation/UserExperience/Conceptual/AquaHIGuidelines/AHIGDialogs/chapter_6_section_3.html[/url]
that
"You can extend the Open dialog as appropriate for your application.
For example, you could include a pop-up menu allowing users to filter
the type of files that appear in the list (see Figure 6-5). Items that
do not meet the filtering criteria would appear dimmed. The system
creates a list of native file types supported by the application to
populate the menu. You can supplement this list with custom types and
specify the default to show when the dialog opens. You should include
an All Applicable Files item, but it does not have to be the default."
How can you do this. In my particular case, I just want to add a
format selection (and I have the same question for a Save Panel).
Thank you very much,
Loïc
Loic BERTRAND Guest
-
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you
<RonGrossi382872@yahoo.com> wrote in message news:1114393703.900419.199790@f14g2000cwb.googlegroups.com... This is the most important question of... -
alert sheet after NSOpenPanel sheet
I'm a Cocoa newbie trying to write a system preference panel. In response to a certain button, I show an NSOpenPanel with beginSheetForDirectory. ... -
matt neuburg #2
Re: NSOpenPanel question
Loic BERTRAND <loic_e_bertrand@yahoo.fr> wrote:
setAccessoryView. m.> You can extend the Open dialog as appropriate for your application.
> For example, you could include a pop-up menu allowing users to filter
> the type of files that appear in the list (see Figure 6-5).
> How can you do this.
--
matt neuburg, phd = [email]matt@tidbits.com[/email], [url]http://www.tidbits.com/matt/[/url]
Read TidBITS! It's free and smart. [url]http://www.tidbits.com[/url]
matt neuburg Guest
-
Eric Pepke #3
Re: NSOpenPanel question
[email]loic_e_bertrand@yahoo.fr[/email] (Loic BERTRAND) wrote in message news:<4487c694.0309180127.2bd09b67@posting.google. com>...
With an NSSavePanel, you just add an accessory view with> How can you do this. In my particular case, I just want to add a
> format selection (and I have the same question for a Save Panel).
setAccessoryView.
NSOpenPanel actually inherits from NSSavePanel (weird!)
and so it works there, too.
Eric Pepke Guest
-
Loic BERTRAND #4
Re: NSOpenPanel question
Thank you for these answers but actully it remains unclear for me:
- how can I generate my accessory view (through a NIB object ?)
- can I write a piece of code to generate one ?
It would be great if one of you could send me a short extract showing
practically how I can do this.
Thank you very much,
Loic
Loic BERTRAND Guest
-
Michael Ash #5
Re: NSOpenPanel question
In article <4487c694.0309190123.218b3665@posting.google.com >,
[email]loic_e_bertrand@yahoo.fr[/email] (Loic BERTRAND) wrote:
Put it in a nib. You can create a raw view in a nib by dragging the> Thank you for these answers but actully it remains unclear for me:
> - how can I generate my accessory view (through a NIB object ?)
> - can I write a piece of code to generate one ?
CustomView object in Interface Builder directly into your nib file's
window. This will create a view that isn't inside any windows or
anything, and you can hook up an outlet to it like normal, then use that
for your accessory view.
You can, of course, always generate these things in code. But it's
complicated. Look at NSView's and NSControl's headers and documentation
to see how if you want to, but doing it in a nib is far better.
Michael Ash Guest
-
matt neuburg #6
Re: NSOpenPanel question
Loic BERTRAND <loic_e_bertrand@yahoo.fr> wrote:
You can, sure. But an easier way is to make an NSView in your nib file> Thank you for these answers but actully it remains unclear for me:
> - how can I generate my accessory view (through a NIB object ?)
> - can I write a piece of code to generate one ?
and make a connection so that you can refer to it. Now when the time
comes to put up your Open panel, use setAccessoryView to point it at
that NSView. You interact with the stuff in the NSView through
connections, just as you would any window or panel. m.
--
matt neuburg, phd = [email]matt@tidbits.com[/email], [url]http://www.tidbits.com/matt/[/url]
Read TidBITS! It's free and smart. [url]http://www.tidbits.com[/url]
matt neuburg Guest
-
Loic BERTRAND #7
Re: NSOpenPanel question
Thank you very much to all of you,
It now works perfectly,
Loic
Loic BERTRAND Guest
-
Eric Pepke #8
Re: NSOpenPanel question
[email]loic_e_bertrand@yahoo.fr[/email] (Loic BERTRAND) wrote in message news:<4487c694.0309190123.218b3665@posting.google. com>...
I generally do short things like this by hand. NIB files are too> Thank you for these answers but actully it remains unclear for me:
> - how can I generate my accessory view (through a NIB object ?)
> - can I write a piece of code to generate one ?
annoying for any but the most common uses. Besides, if you
need a NIB file, it probably means you're trying to put too much
in there.
Here's an example. It's just a single check box whereby the
user can automatically create a subdirectory when saving a
new project:
savePanel = [NSSavePanel savePanel];
dirSwitch = [NSButton alloc];
[dirSwitch initWithFrame:rect];
[dirSwitch setAutoresizingMask:NSViewWidthSizable |
NSViewMaxYMargin | NSViewHeightSizable];
[dirSwitch setTitle:[mainBundle
localizedStringForKey:@"HLPNewProj" value:nil table:@"Help"]];
[dirSwitch setToolTip:[mainBundle
localizedStringForKey:@"HLPNewProjTip" value:nil table:@"Help"]];
[dirSwitch setState:NSOnState];
[dirSwitch setButtonType:NSSwitchButton];
[dirSwitch setAutoresizingMask:NSViewWidthSizable];
[savePanel setAccessoryView:dirSwitch];
Eric Pepke Guest
-
Michael Ash #9
Re: NSOpenPanel question
In article <ef37f531.0309201837.59f036a0@posting.google.com >,
[email]epepke@acm.org[/email] (Eric Pepke) wrote:
I beg to disagree. First, the code using the NSOpenPanel is probably a> [email]loic_e_bertrand@yahoo.fr[/email] (Loic BERTRAND) wrote in message
> news:<4487c694.0309190123.218b3665@posting.google. com>...>> > Thank you for these answers but actully it remains unclear for me:
> > - how can I generate my accessory view (through a NIB object ?)
> > - can I write a piece of code to generate one ?
> I generally do short things like this by hand. NIB files are too
> annoying for any but the most common uses. Besides, if you
> need a NIB file, it probably means you're trying to put too much
> in there.
window controller, thus it probably already owns a nib where the view
could be stashed easily. And how exactly are nib files "annoying"?
Assuming you already have a nib that you're loading, you can load the
view "for free" when you load the window, just by adding an outlet, no
code needed. Even if you don't, it's a single line of code to load the
nib and connect the view to your outlet. It's a lot shorter than your
example code, and allows you to change things around a lot easier.
Michael Ash Guest



Reply With Quote

