dev_open_file_dialogdev_open_file_dialogDevOpenFileDialogDevOpenFileDialogdev_open_file_dialog (Operator)
Name
dev_open_file_dialogdev_open_file_dialogDevOpenFileDialogDevOpenFileDialogdev_open_file_dialog
— Opens a file selection dialog.
Signature
def dev_open_file_dialog(filter: str, mode: str, path: str) -> Sequence[str]
def dev_open_file_dialog_s(filter: str, mode: str, path: str) -> str
Description
dev_open_file_dialogdev_open_file_dialogDevOpenFileDialogDevOpenFileDialogDevOpenFileDialogdev_open_file_dialog
opens a file selection dialog for
reading one file (ModeModeModeModemodemode
= 'read'"read""read""read""read""read"), reading one or more
files (ModeModeModeModemodemode
= 'read_multi'"read_multi""read_multi""read_multi""read_multi""read_multi"), writing
(ModeModeModeModemodemode
= 'write'"write""write""write""write""write") a file or choosing
(ModeModeModeModemodemode
= 'dir'"dir""dir""dir""dir""dir") a directory.
If ModeModeModeModemodemode
is set to 'default'"default""default""default""default""default" and FilterFilterFilterFilterfilterfilter
is set to
an HALCON operator the type is set to the value the operator would use.
The FilterFilterFilterFilterfilterfilter
can be used to select the types of the files which shall
be selected for reading or writing. The FilterFilterFilterFilterfilterfilter
can be set to
an HALCON operator, for example read_imageread_imageReadImageReadImageReadImageread_image
, which should read or write
the selected file. In that case, the filter is set appropriate to the files
used by the HALCON operator.
To select images of type JPEG and TIFF the filter could be set to
'Images (*.jpg *.tif *.tiff)'"Images (*.jpg *.tif *.tiff)""Images (*.jpg *.tif *.tiff)""Images (*.jpg *.tif *.tiff)""Images (*.jpg *.tif *.tiff)""Images (*.jpg *.tif *.tiff)"
or 'JPEG Files (*.jpg);;TIFF-Files (*.tif *.tiff)'"JPEG Files (*.jpg);;TIFF-Files (*.tif *.tiff)""JPEG Files (*.jpg);;TIFF-Files (*.tif *.tiff)""JPEG Files (*.jpg);;TIFF-Files (*.tif *.tiff)""JPEG Files (*.jpg);;TIFF-Files (*.tif *.tiff)""JPEG Files (*.jpg);;TIFF-Files (*.tif *.tiff)".
In the first case, by selecting the entry 'Images' all supported
images files are displayed together. In the
second case it is possible to choose between JPEG Files or TIFF Files.
The Filter is not case sensitive, therefore the same results
are supplied by 'JPEG Files (*.jpg)'"JPEG Files (*.jpg)""JPEG Files (*.jpg)""JPEG Files (*.jpg)""JPEG Files (*.jpg)""JPEG Files (*.jpg)" and
'JPEG Files (*.JPG)'"JPEG Files (*.JPG)""JPEG Files (*.JPG)""JPEG Files (*.JPG)""JPEG Files (*.JPG)""JPEG Files (*.JPG)".
The 'All Files (*)'"All Files (*)""All Files (*)""All Files (*)""All Files (*)""All Files (*)" is always added.
To combine more than one filter you have to separate them
by ';;'";;"";;"";;"";;"";;".
Examples:
The filter 'Images (*.jpg *.tiff *.tif)'"Images (*.jpg *.tiff *.tif)""Images (*.jpg *.tiff *.tif)""Images (*.jpg *.tiff *.tif)""Images (*.jpg *.tiff *.tif)""Images (*.jpg *.tiff *.tif)" lists all files with
the extensions jpg, tiff and tif.
The filter 'JPEG Files (*.jpg)'"JPEG Files (*.jpg)""JPEG Files (*.jpg)""JPEG Files (*.jpg)""JPEG Files (*.jpg)""JPEG Files (*.jpg)" lists all files with the
extension jpg.
Combination of 3 filters:
'Images (*.jpg *.tiff *.tif);;JPEG Files (*.jpg);;TIFF Files
(*.tiff *.tif)'"Images (*.jpg *.tiff *.tif);;JPEG Files (*.jpg);;TIFF Files
(*.tiff *.tif)""Images (*.jpg *.tiff *.tif);;JPEG Files (*.jpg);;TIFF Files
(*.tiff *.tif)""Images (*.jpg *.tiff *.tif);;JPEG Files (*.jpg);;TIFF Files
(*.tiff *.tif)""Images (*.jpg *.tiff *.tif);;JPEG Files (*.jpg);;TIFF Files
(*.tiff *.tif)""Images (*.jpg *.tiff *.tif);;JPEG Files (*.jpg);;TIFF Files
(*.tiff *.tif)"
The PathPathPathPathpathpath
can be used to set the working directory.
If PathPathPathPathpathpath
is set to 'default'"default""default""default""default""default" the working directory is
set to the last one used for this type of ModeModeModeModemodemode
.
After a successful execution the SelectionSelectionSelectionSelectionselectionselection
contains the
selected files or file.
Attention
This operator is not supported for code export.
Parameters
FilterFilterFilterFilterfilterfilter
(input_control) string →
HTuplestrHTupleHtuple (string) (string) (HString) (char*)
Type of file or files to select.
ModeModeModeModemodemode
(input_control) string →
HTuplestrHTupleHtuple (string) (string) (HString) (char*)
Mode of the file selection dialog.
Default:
'default'
"default"
"default"
"default"
"default"
"default"
List of values:
'default'"default""default""default""default""default", 'dir'"dir""dir""dir""dir""dir", 'read'"read""read""read""read""read", 'read_multi'"read_multi""read_multi""read_multi""read_multi""read_multi", 'write'"write""write""write""write""write"
PathPathPathPathpathpath
(input_control) string →
HTuplestrHTupleHtuple (string) (string) (HString) (char*)
Working directory.
Default:
'default'
"default"
"default"
"default"
"default"
"default"
SelectionSelectionSelectionSelectionselectionselection
(output_control) string(-array) →
HTupleSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Selected file names.
Default:
'default'
"default"
"default"
"default"
"default"
"default"
Example (HDevelop)
dev_open_file_dialog ('read_image', 'default','c:/',Selection)
read_image(ToolId, Selection)
Result
If the values of the specified parameters are correct,
dev_open_file_dialogdev_open_file_dialogDevOpenFileDialogDevOpenFileDialogDevOpenFileDialogdev_open_file_dialog
returns 2 (
H_MSG_TRUE)
. Otherwise, an
exception is raised and an error code returned.
Alternatives
dev_open_dialogdev_open_dialogDevOpenDialogDevOpenDialogDevOpenDialogdev_open_dialog
See also
dev_open_dialogdev_open_dialogDevOpenDialogDevOpenDialogDevOpenDialogdev_open_dialog
Module
Foundation