Le 4 déc. 06 à 16:11 Soir, Dixon, Tom a écrit:

Are you wanting to do this through an Open Dialog or silently? If you
are using RB2006 and an open dialog you create a file types object,
(right click in the project and select Add then File Types Set). In the
File Types set you specify the display names, the Mac Type/Creator and
extensions. For example the following is a set for two image file types
in a File Types Set called ImageFileTypes:

Display Name: JPEG File
Object Name: JPEGFile
MacType: JPEG
MacCreator: ????
Extensions: .jpg;.jpeg

Display Name: TIFF File
Object Name: TIFFFile
MacType: TIFF
MacCreator: ????
Extensions: .tif;.tiff

Then when you use the open Dialog you specify it to filter what is shown
by all the file types in the File Types Set as follows.

  Dim dlg as OpenDialog
  Dim f as FolderItem
  dlg= New OpenDialog

  dlg.InitialDirectory= SpecialFolder.Desktop

  dlg.Title="Select a an Image File"
  dlg.Filter = ImageFileTypes.All
  f=dlg.ShowModal()
  If f <> Nil then
    // Do something with the image file
     Else
    //User Cancelled
  End if

I think I asked for the non-open dialog way.

What about using an array containing all the file types and using the IndexOf property?

such as:

dim f As folderitem
 dim s() As String

s.append "Pict files"
s.append "Text files"

f=DocumentsFolder.child("Test.jpg")
if s.IndexOf(f.type)>-1 then
msgbox "It's a valid file."
end

PS. Syntax also made for RB 5.5_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to