Google Групи вече не поддържа нови публикации или абонаменти в Usenet. Съдържанието за минали периоди остава видимо.

Filtering based on file extension using Nav Services

3 показвания
Преминаване към първото непрочетено съобщение

John C

непрочетено,
10.10.2000 г., 1:02:3010.10.00 г.
до
I would like to display only files with a ".DXF" extension in my file
dialog box. I have this working with the old StandardFile dialog using a
filterProc, but I cannot for the life of me find any documentation on
how to do this in Navigation Services. The closets I've found to a Nav
Services filterProc is below, but this filter just filters on file type:

pascal Boolean myFilterProc(AEDesc* theItem, void* info,
NavCallBackUserData callBackUD,
NavFilterModes filterMode)
{
OSErr theErr = noErr;
Boolean display = true;
NavFileOrFolderInfo* theInfo = (NavFileOrFolderInfo*)info;

if (theItem->descriptorType == typeFSS)
if (!theInfo->isFolder)
if (theInfo->fileAndFolder.fileInfo.finderInfo.fdType
!= 'TEXT')
display = false;
return display;
}


Anyone have any ideas on how to filter based on file extension (or, for
that matter, on filename)?

Thanks,

John C

Richard Drysdall

непрочетено,
10.10.2000 г., 3:00:0010.10.00 г.
до
In article <macjohn-00664C...@news.gte.net>, John C
<mac...@mail.com> wrote:

I haven't compiled this example, but I've modified your code based on an
application of mine which does filtering based on extensions. Basically,
the only trick is knowing how to get the FSSpec for the file:

> pascal Boolean myFilterProc(AEDesc* theItem, void* info,
> NavCallBackUserData callBackUD,
> NavFilterModes filterMode)
> {
> OSErr theErr = noErr;

Boolean display = false;
> NavFileOrFolderInfo* theInfo = (NavFileOrFolderInfo*)info;
FSSpec theFSSpec;


>
> if (theItem->descriptorType == typeFSS)
> if (!theInfo->isFolder)

if (theInfo->fileAndFolder.fileInfo.finderInfo.fdType ==
'TEXT')
{
BlockMoveData (*theItem -> dataHandle, &theFSSpec,
sizeof (theFSSpec));
// if theFSSpec.name ok, set display = true
}

> return display;
> }

--
Richard Drysdall, Auckland, New Zealand.

Rowan Daniell

непрочетено,
10.10.2000 г., 23:51:1010.10.00 г.
до
in article macjohn-00664C...@news.gte.net, John C at
mac...@mail.com wrote on 10/10/00 6:02 PM:

You are almost there: Use

FSSpec finalFSSpec;
#if OPAQUE_TOOLBOX_STRUCTS // carbon
AEGetDescData(theItem, &finalFSSpec, sizeof(FSSpec));
#else // pre carbon
BlockMoveData(*theItem->dataHandle, &finalFSSpec, sizeof(FSSpec));
#endif

to get the actual FSSpec record for the file. Then you have the filename in
finalFSSpec.name. Parse the file name to see if it ends in .DXF.

Remember to return false for the files you *do* want to show. True filters
them out. (opposite of Standard File)


--
Rowan Daniell tel:+64-9-486-0282
Cognito Software Ltd fax:+64-9-489-6010
http://www.cognito.co.nz

0 нови съобщения