如何在REALbasic中创建“选择文件夹或文件对话框窗口”?

时间:2008-09-19 07:27:12

标签: realbasic

您可以使用

SelectFolder()获取文件夹

GetOpenFolderitem(过滤为字符串)以获取文件

但您可以选择文件夹或文件吗? (或选择多个文件)

4 个答案:

答案 0 :(得分:5)

MonkeyBread插件允许在OpenDialogMBS类中使用它。

http://www.monkeybreadsoftware.net/pluginhelp/navigation-opendialogmbs.shtml

OpenDialogMBS.AllowFolderSelection as Boolean
property, Navigation, MBS Util Plugin (OpenDialog), class OpenDialogMBS, Plugin version: 7.5, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Whether folders can be selected.
Example: 
dim o as OpenDialogMBS
dim i,c as integer
dim f as FolderItem

o=new OpenDialogMBS
o.ShowHiddenFiles=true
o.PromptText="Select one or more files/folders:"
o.MultipleSelection=false
o.ActionButtonLabel="Open files/folders"
o.CancelButtonLabel="no, thanks."
o.WindowTitle="This is a window title."
o.ClientName="Client Name?"
o.AllowFolderSelection=true
o.ShowDialog

c=o.FileCount
if c>0 then
  for i=0 to c-1
    f=o.Files(i)

    FileList.List.AddRow f.AbsolutePath
  next
end if


Notes: 
Default is false.
Setting this to true on Windows or Linux has no effect there.
(Read and Write property)

答案 1 :(得分:0)

通过任何内置API都无法实现。可能有一个插件可以执行此操作,但我认为没有操作系统支持它。

答案 2 :(得分:0)

有点晚了,但它已包含在最新版本中。我会把它放在这里以防万一在这个问题上有人像我这样绊倒:

RealBasic Multiple Selection: OpenDialog.MultiSelect

答案 3 :(得分:-3)

假设您正在使用.Net,我认为您需要创建自己的控件(或购买一个)。