[futurebasic] Re: [FB] RTFtoTXT using Objective-C in FB5

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 2009 : Group Archive : Group : All Groups

From: Robert Purves <listrp@...>
Date: Thu, 9 Jul 2009 21:55:11 +1200
Ken Shmidheiser wrote:

> I am stuck on getting File$ to selectively filter out only RTF  
> files. Maybe someone can point out the error of my ways.

Use NavDialog instead of files$.

local fn MyGetFileHandler( reply as ^NavReplyRecord, userData as  
pointer )
'~'1
dim as CFUrlRef   url

NavDialog_CopyItemCFURLRef( #reply, 1, @url )
...your code to do stuff with url here...
end fn


local fn MyNavFilter( theItem as ^AEDesc, info as  
^NavFileOrFolderInfo, callbackUD as pointer, filterMode as  
NavFilterModes ) as Boolean
'~'1
dim as Boolean   display : display = _false

if ( info.isFolder ) then display = _true : exit fn // always allow  
going into folders
if ( fn NavDialog_UTIConformsTo( #theItem, fn  
CFSTR( "public.rtf" ) ) ) then display = _true : exit fn
end fn = display


NavDialog_SetFilterFn( @fn MyNavFilter )
NavDialog( _kNavDialogGetFile, "Open RTF file", "", @fn  
MyGetFileHandler, 0 )


Robert P.