首页 > comp > gb.qt4 > dialog > openfile 
 en fr de es it nl pl pt pt_BR mk sq ca hu cs tr ar fa id vi ko ja ru zh eo
前一个  下一个  编辑  重命名  撤销  搜索  管理  
文档  
警告! 该页面未翻译。  参见英文版 
Dialog.OpenFile (gb.qt4)
Static Function OpenFile ( [ Multi As Boolean ] ) As Boolean

Calls the file standard /comp/gb.form/dialog to get the name of a file to open.

This method returns TRUE if the user clicked on the Cancel button, and FALSE if the user clicked on the OK button.

Example

Dialog.Title = "Choose a file"
Dialog.Filter = ["*.txt", "Text Files", "*", "All files"]
Dialog.Path = "."
IF Dialog.OpenFile() THEN
  RETURN ' User pressed Cancel -
ENDIF

This example shows how you can select multiple files with the OpenFile dialog. By setting the Dialog.Path when the application starts the first time the dialog is opened it will show the users home directory.

PUBLIC SUB Form_Open()
  Dialog.Path = User.Home
END

PUBLIC SUB ButtonOpenMultiple_Click()
  DIM imageFile AS String
  Dialog.Filter = ["*.png", "Portable Network Graphics"]
  IF Dialog.OpenFile(TRUE) THEN RETURN
  FOR EACH imageFile IN Dialog.Paths
    PRINT imageFile
  NEXT
CATCH
  Message.Info(Error.Text)
END