Platforms to show: All Mac Windows Linux Cross-Platform

/Util/OpenDialog with Filter


Required plugins for this example: MBS Util Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Util/OpenDialog with Filter

This example is the version from Fri, 21th Nov 2019.

Project "OpenDialog with Filter.xojo_binary_project"
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu7 = ""
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
MenuItem UntitledMenu6 = ""
MenuItem UntitledMenu5 = ""
MenuItem UntitledMenu4 = ""
End MenuBar
Class App Inherits Application
EventHandler Sub Open() dim o as MyOpenDialogMBS dim i,c as integer dim f as FolderItem dim t as OpenDialogFileTypeMBS o=new MyOpenDialogMBS o.ShowHiddenFiles=true o.PromptText="Select one or more files:" o.MultipleSelection=false o.ActionButtonLabel="Open files" o.CancelButtonLabel="no, thanks." o.WindowTitle="This is a window title." o.ClientName="Client Name?" if TargetWin32 then // On Windows, use the Filetype popup, on Mac the event t=new OpenDialogFileTypeMBS t.Name="JPEG files" // for Windows only t.Extension="*.JPG" // Windows only o.AddType t end if o.ShowDialog c=o.FileCount if c>0 then for i=0 to c-1 f=o.Files(i) dim Path as string = f.nativePath FileList.List.AddRow path next else // MsgBox "no file was selected." quit end if End EventHandler
End Class
Class FileList Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
End Class
Class MyOpenDialogMBS Inherits OpenDialogMBS
EventHandler Function FilterItem(file as folderitem, filterMode as integer) As boolean #Pragma unused filterMode '#pragma disableautowaitcursor If Not file.Directory And Right(file.Name,4)<>".JPG" And Right(file.Name,5)<>".JPEG" Then Return True // hide them End If End EventHandler
End Class
End Project

See also:

The items on this page are in the following plugins: MBS Util Plugin.


The biggest plugin in space...