Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3637

Can only select files and not directories

$
0
0

My program scans a file OR directory and analyzes it’s properties, however the OpenFileDialog in Xojo
on Linux seems to only be able to select files. Not sure if this is a flaw of Xojo or the system file chooser. It could also be me, if below looks wrong please let me know!
Else is there a way to make Xojo pick a file OR folder? Thank you!

Public Function SelectTargetDialog(startAt as String) As FolderItem
  Var selectedItem As FolderItem
  
  Var dlg As New OpenFileDialog
  dlg.InitialFolder= SpecialFolder.UserHome
  dlg.AllowMultipleSelections= False
  
  If(startAt.Lowercase="home") Then
    dlg.InitialFolder = SpecialFolder.UserHome
  ElseIf(startAt.Lowercase="docs") Then
    dlg.InitialFolder = SpecialFolder.Documents
  ElseIf(startAt.Lowercase="pics") Then
    dlg.InitialFolder = SpecialFolder.Pictures
  ElseIf(startAt.Lowercase="sys") Then
    dlg.InitialFolder = SpecialFolder.Caches
  Else
    dlg.InitialFolder = SpecialFolder.UserHome
  End
  
  Var f As FolderItem= dlg.ShowModal
  
  For Each file As Folderitem In dlg.SelectedFiles
    selectedItem= file
  Next
  Return selectedItem
  
End Function

On Linux Mint 21.3 with Cinnamon

6 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 3637

Trending Articles