Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / CodeWarrior / May 2004



Tip: Looking for answers? Try searching our database.

Nav Services weirdness

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andy Bettis - 26 May 2004 13:55 GMT
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>

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.