# setting default file location with NavCreateGetFileDialog



## shannen (Jun 27, 2003)

Hi,
 I was trying to set the default file location using the NavCreateGetFileDialog but failed. The following is what I have done. Please advice and thank you very much.

 The call is:

code:

OSStatus theErr = ::NavCreateGetFileDialog( &theDialogOptions, theTypes, DialogCallback, NULL, OpenFileFilterCallback, this, &m_DialogBox );

The functions are as follows
pascal void CFileOpenDialog:ialogCallback( NavEventCallbackMessage inCallbackSelector, NavCBRecPtr inCallbackParms, void* inCallbackUD )
{
        CFileOpenDialog* theDialog = static_cast<CFileOpenDialog*>( inCallbackUD );

        theDialog->HandleCallback( inCallbackSelector, inCallbackParms );
}

void CFileOpenDialog::HandleCallback( NavEventCallbackMessage inCallbackSelector, NavCBRecPtr inCallbackParms )
{
        if ( inCallbackParms )
                inCallbackParms = NULL;

        switch( inCallbackSelector)
        {
                case kNavCBStart:
                {
                        if ( m_StartLocation.GetAbsolutePath( ) != "" )
                        {
                                //AEStorageDataType theStorage;
                                AEDesc theLocation = { typeNull, NULL };

                                FSSpec theFSSpec = m_StartLocation.GetFSSpec( );

                                OSStatus theStatus = ::AECreateDesc( typeFSS, &theFSSpec, sizeof(FSSpec), &theLocation );

                                if ( theStatus == noErr )
                                        theStatus = ::NavCustomControl( m_DialogBox, kNavCtlSetLocation, (void*)&theLocation);

                        }
                }
                break;          
        }
}


 fyi: the last statement (theStatus = .....) returns me an error code of -50. Appreciate for all help render. Thanks


----------

