Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS iOS Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /iOS/Document Picker iOS
This example is the version from Wed, 5th Jul 2022.
Project "Document Picker iOS.xojo_binary_project"
Class App Inherits MobileApplication
End Class
Class MainScreen Inherits MobileScreen
Control OpenButton Inherits MobileButton
ControlInstance OpenButton Inherits MobileButton
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
EventHandler Sub Pressed()
table1.RemoveAllRows
OpenButton.Enabled = False
ExportButton.Enabled = False
Dim types() As String
types.append "image/jpeg"
types.append ".txt"
types.append "com.adobe.pdf"
Dim asCopy As Boolean = True
picker = New UIDocumentPicker(UIDocumentPicker.ModeOpen, types, asCopy)
picker.Screen = Self
picker.Present
End EventHandler
End Control
Control Table1 Inherits iOSMobileTable
ControlInstance Table1 Inherits iOSMobileTable
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
End Control
Control ExportButton Inherits MobileButton
ControlInstance ExportButton Inherits MobileButton
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
EventHandler Sub Pressed()
Dim pic As Picture = LogoMBS(500)
Dim file As FolderItem = SpecialFolder.Documents.Child("test.jpg")
pic.Save(file, Picture.Formats.JPEG)
OpenButton.Enabled = False
ExportButton.Enabled = False
Dim URLs() As String
urls.add(file.URLPath)
picker = New UIDocumentPicker(UIDocumentPicker.ModeExportToService, URLs, True)
picker.Screen = Self
picker.Present
End EventHandler
End Control
Property picker As UIDocumentPicker
End Class
Class LaunchScreen Inherits iosView
End Class
Class UIDocumentPicker Inherits UIDocumentPickerMBS
EventHandler Sub documentPickerDidPickDocuments(URLs() as String)
If me.documentPickerMode = ModeExportToService Then
MessageBox "Exported."
Else // import/open
For Each url As String In urls
dim file as new FolderItem(url, FolderItem.PathModes.URL)
screen.Table1.AddRow file.DisplayName
Next
end if
Screen.OpenButton.Enabled = True
Screen.ExportButton.Enabled = True
Screen = Nil
End EventHandler
EventHandler Sub documentPickerWasCancelled()
Screen.OpenButton.Enabled = True
screen.ExportButton.Enabled = true
Screen = Nil
End EventHandler
Property screen As MainScreen
End Class
End Project
The items on this page are in the following plugins: MBS iOS Plugin.