Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!batcomputer!cornell!rochester!pt.cs.cmu.edu!vi.ri.cmu.edu!eahb From: eahb@vi.ri.cmu.edu (Edwin Blackwood) Newsgroups: comp.sys.next Subject: Re: OpenPanel for Directories Message-ID: <13637@pt.cs.cmu.edu> Date: 26 Jun 91 12:22:15 GMT References: <91176.113704DWN2@psuvm.psu.edu> <1991Jun25.195535.8745@noose.ecn.purdue.edu> Organization: Carnegie-Mellon University, CS/RI Lines: 34 In article <1991Jun25.195535.8745@noose.ecn.purdue.edu> songer@orchestra.ecn.purdue.edu (Christopher M Songer) writes: >OK, > It must be in the docs somewhere and I can't find it. I want >an OpenPanel to allow the return of a filename which is a directory. >I don't want the contents of the directory shown when the user >selects it. The directory name does have a unique extension. >How do I do this? (WriteNow does it sometimes... why can't I?) > >Thanks! >-Chris You need to declare the types of extensions your app will look for in the open panel -- like this: static const char *openTypes[] = {"ext1", "ext2", NULL}; // do not include the ".", ie "wn", not ".wn" id openPanel = [OpenPanel new]; static char dir[MAXPATHLEN+1]; static char file[MAXPATHLEN+1] // decide what directory and file you want to default the open panel to if ([openPanel runModalForDirectory:dir file:file types:openTypes]) { //do your thing } else { // can't do your thing because openPanel failed or was canceled } Hope this helps. Ed Blackwood eahb@visus.com Software Engineer: Visual Understanding Systems, Inc. (VISUS). Developers of PaperSight - the only integrated document image management system for the NeXT