Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

help with NavCreateGetFileDialog() and file types



Hi,
This is my first time using any Apple specific APIs and i'm somewhat new to C too so if any of my questions seem kinda stupid keep that in mind :)


I am trying to add an Carbon interface to a small existing program and I'm having trouble getting the browse for file thing to work. I have done some searching and found that NavCreateGetFileDialog() or NavCreateChooseFileDialog() should be used, and i have gotten it to the point that i can open the application with the main window, click browser, open the browse dialog, and then thats where i have a problem, my application needs ASCII input files (they just consist of spaces, tabs and numbers) and the files have no extension, i would preferably like to be able to show only ASCII text files, but i would settle for anything that lets me select a file at this point as right now every file type i put in seem to have no affect at all. Every file shows up all grayed out and i cannot select any file.

Also can anyone point me something that talk about the basics for coding on a Mac/Carbon, i spent far too much time trying to figure out what a NavListTypeHandle was, same goes with learning about CFSTR() and OSType, is there any documentation that gives an overview of these core functions and types that everything needs for even the simple tasks?

	Thanks in advanced


here is my relevant code:

....a few static variables
//our open file dialogs
static NavDialogRef OpenFileRef;

//hold the file types that may be opened and related info
static NavTypeListHandle hTypeList;
static NavReplyRecord replyNav;
int main(blah){
...some code to initialize some thing...
    //for the file open dialog, we need these
    fileOpenStatus = NavGetDefaultDialogCreationOptions (&fileOpenOptions);
    fileOpenOptions.clientName = CFSTR("Supply & Demand");

//we can pick any file type
hTypeList = (NavTypeListHandle)NewHandleClear(sizeof(NavTypeList) + sizeof(OSType));


    HLock ((Handle) hTypeList);
    (**hTypeList).componentSignature = kNavGenericSignature;
    (**hTypeList).osTypeCount = 2;
    (**hTypeList).osType[0] = 'TEXT';
    //UTGetOSTypeFromString(CFSTR("TEXT"));
    (**hTypeList).osType[1] = '????';
    HUnlock((Handle) hTypeList);//let it more a bit

    ....code to start/run the interface...
}

static OSStatus AppEventHandler(blah){
	..inside switch() for the "Browse" button
	NavCreateGetFileDialog(&fileOpenOptions, hTypeList, NULL, NULL,
               NULL, NULL, &OpenFileRef);
        NavDialogRun (OpenFileRef);
       ..cleanup code is not in yet, i'll add it when i can select files

}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.