Here's a good one.
I have a common routine for prompting the user for a file:
Boolean
CDocument::ChooseFile(
SInt16 inTypeCount,
OSType* inFileTypes,
FSSpec& outFileSpec)
{
LFileTypeList theTypesList(inTypeCount,inFileTypes);
PP_StandardDialogs::LFileChooser chooser;
NavDialogOptions* options = chooser.GetDialogOptions();
if (options != nil) {
options->dialogOptionFlags = kNavDefaultNavDlogOptions
+ kNavSelectAllReadableItem;
}
return(chooser.AskChooseOneFile(theTypesList,outFileSpec));
}
Now, if I call this from within the document all is well, but if I call
it from a dialog box it doesn't allow some file types to be chosen, The
dialog calling routine includes:
static OSType theTypes[] = {kQTFileTypeWave,kQTFileTypeMIDI,
kQTFileTypeSystemSevenSound,kQTFileTypeAIFF,
kQTFileTypeSoundDesignerII,kQTFileTypeAudioCDTrack};
static SInt16 theTypeCount = 6;
FSSpec theFileSpec;
if (mDocument->ChooseFile(theTypeCount,theTypes,theFileSpec)) {
// Do stuff
But only AIFF files show as selectable. Whereas the document version
(which allows movie files too) looks like:
static OSType theTypes[] = {kQTFileTypeAIFF, kQTFileTypeAIFC,
kQTFileTypeDVC, kQTFileTypeMIDI, kQTFileTypeMovie, kQTFileTypeWave,
kQTFileTypeSystemSevenSound, kQTFileTypeAVI, kQTFileTypeSoundDesignerII,
kQTFileTypeAudioCDTrack};
static SInt16 theTypeCount = 10;
FSSpec theFileSpec;
if (ChooseFile(theTypeCount,theTypes,theFileSpec)) {
// Do stuff
And all is well, they can all be chosen.
I realise that Nav Services was developed to stop developers doing
things simply, but I can't see where I'm going wrong. Help!
Rev. Andy
PS I know there's no error handling.
Miro Jurisic - 26 May 2004 16:34 GMT
> I realise that Nav Services was developed to stop developers doing
> things simply, but I can't see where I'm going wrong. Help!
My guess is that there is a Carbon event handler installed that is disabling
those items. Where that handler is, I have no idea, but I would probably run the
app under gdb, set a breakpoint on Enable/DisableMenuItem, and see where it's
called from when that dialog comes up.
meeroh

Signature
If this message helped you, consider buying an item
from my wish list: <http://web.meeroh.org/wishlist>