]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/filedlg.tex
fixed another return FALSE in a function returning a pointer (patch 545046)
[wxWidgets.git] / docs / latex / wx / filedlg.tex
CommitLineData
a660d684
KB
1\section{\class{wxFileDialog}}\label{wxfiledialog}
2
3This class represents the file chooser dialog.
4
5\wxheading{Derived from}
6
7\helpref{wxDialog}{wxdialog}\\
8\helpref{wxWindow}{wxwindow}\\
9\helpref{wxEvtHandler}{wxevthandler}\\
10\helpref{wxObject}{wxobject}
11
954b8ae6
JS
12\wxheading{Include files}
13
14<wx/filedlg.h>
15
a660d684
KB
16\wxheading{See also}
17
18\helpref{wxFileDialog overview}{wxfiledialogoverview}, \helpref{wxFileSelector}{wxfileselector}
a660d684
KB
19
20\wxheading{Remarks}
21
22Pops up a file selector box. In Windows, this is the common file selector
23dialog. In X, this is a file selector box with somewhat less functionality.
24The path and filename are distinct elements of a full file pathname.
25If path is ``", the current directory will be used. If filename is ``",
26no default filename will be supplied. The wildcard determines what files
27are displayed in the file selector, and file extension supplies a type
28extension for the required filename. Flags may be a combination of wxOPEN,
f59d80ca 29wxSAVE, wxOVERWRITE\_PROMPT, wxHIDE\_READONLY, wxFILE\_MUST\_EXIST, wxMULTIPLE or 0.
a660d684
KB
30
31Both the X and Windows versions implement a wildcard filter. Typing a
32filename containing wildcards (*, ?) in the filename text item, and
33clicking on Ok, will result in only those files matching the pattern being
330d6fd0 34displayed. The wildcard may be a specification for multiple
a660d684
KB
35types of file with a description for each, such as:
36
37\begin{verbatim}
58abfef6 38 "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
a660d684
KB
39\end{verbatim}
40
41\latexignore{\rtfignore{\wxheading{Members}}}
42
43\membersection{wxFileDialog::wxFileDialog}\label{wxfiledialogconstr}
44
45\func{}{wxFileDialog}{\param{wxWindow* }{parent}, \param{const wxString\& }{message = "Choose a file"},\rtfsp
46\param{const wxString\& }{defaultDir = ""}, \param{const wxString\& }{defaultFile = ``"},\rtfsp
47\param{const wxString\& }{wildcard = ``*.*"}, \param{long }{style = 0}, \param{const wxPoint\& }{pos = wxDefaultPosition}}
48
49Constructor. Use \helpref{wxFileDialog::ShowModal}{wxfiledialogshowmodal} to show the dialog.
50
51\wxheading{Parameters}
52
53\docparam{parent}{Parent window.}
54
55\docparam{message}{Message to show on the dialog.}
56
57\docparam{defaultDir}{The default directory, or the empty string.}
58
59\docparam{defaultFile}{The default filename, or the empty string.}
60
6a611b39 61\docparam{wildcard}{A wildcard, such as ``*.*" or ``BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif".}
a660d684
KB
62
63\docparam{style}{A dialog style. A bitlist of:
64
65\twocolwidtha{5cm}
66\begin{twocollist}
330d6fd0
RR
67\twocolitem{{\bf wxOPEN}}{This is an open dialog.}
68\twocolitem{{\bf wxSAVE}}{This is a save dialog.}
9c470b60 69\twocolitem{{\bf wxHIDE\_READONLY}}{For open dialog only: hide the checkbox allowing to open the file in read-only mode.}
302a1eca 70\twocolitem{{\bf wxOVERWRITE\_PROMPT}}{For save dialog only: prompt for a confirmation if a file will be overwritten.}
3f6638b8 71\twocolitem{{\bf wxMULTIPLE}}{For open dialog only: allows selecting multiple files.}
9c470b60 72\twocolitem{{\bf wxCHANGE\_DIR}}{Change the current working directory to the directory where the file(s) chosen by the user are.}
a660d684
KB
73\end{twocollist}%
74}
75
76\docparam{pos}{Dialog position. Not implemented.}
77
3f6638b8
VZ
78{\bf NB:} Previous versions of wxWindows used {\tt wxCHANGE\_DIR} by default
79under MS Windows which allowed the program to simply remember the last
80directory where user selected the files to open/save. This (desired)
81functionality must be implemented in the program itself now (manually remember
82the last path used and pass it to the dialog the next time it is called) or
83by using this flag.
84
a660d684
KB
85\membersection{wxFileDialog::\destruct{wxFileDialog}}
86
87\func{}{\destruct{wxFileDialog}}{\void}
88
89Destructor.
90
91\membersection{wxFileDialog::GetDirectory}\label{wxfiledialoggetdirectory}
92
93\constfunc{wxString}{GetDirectory}{\void}
94
95Returns the default directory.
96
97\membersection{wxFileDialog::GetFilename}\label{wxfiledialoggetfilename}
98
99\constfunc{wxString}{GetFilename}{\void}
100
101Returns the default filename.
102
c61f4f6d
VZ
103\membersection{wxFileDialog::GetFilenames}\label{wxfiledialoggetfilenames}
104
105\constfunc{void}{GetFilenames}{\param{wxArrayString\& }{filenames}}
106
107Fills the array {\it filenames} with the names of the files chosen. This
108function should only be used with the dialogs which have {\tt wxMULTIPLE} style,
109use \helpref{GetFilename}{wxfiledialoggetfilename} for the others.
110
a660d684
KB
111\membersection{wxFileDialog::GetFilterIndex}\label{wxfiledialoggetfilterindex}
112
113\constfunc{int}{GetFilterIndex}{\void}
114
115Returns the index into the list of filters supplied, optionally, in the wildcard parameter.
116Before the dialog is shown, this is the index which will be used when the dialog is first displayed.
117After the dialog is shown, this is the index selected by the user.
118
119\membersection{wxFileDialog::GetMessage}\label{wxfiledialoggetmessage}
120
121\constfunc{wxString}{GetMessage}{\void}
122
123Returns the message that will be displayed on the dialog.
124
125\membersection{wxFileDialog::GetPath}\label{wxfiledialoggetpath}
126
127\constfunc{wxString}{GetPath}{\void}
128
129Returns the full path (directory and filename) of the selected file.
130
c61f4f6d
VZ
131\membersection{wxFileDialog::GetPaths}\label{wxfiledialoggetpaths}
132
133\constfunc{void}{GetPaths}{\param{wxArrayString\& }{paths}}
134
135Fills the array {\it paths} with the full paths of the files chosen. This
136function should only be used with the dialogs which have {\tt wxMULTIPLE} style,
137use \helpref{GetPath}{wxfiledialoggetpath} for the others.
138
a660d684
KB
139\membersection{wxFileDialog::GetStyle}\label{wxfiledialoggetstyle}
140
141\constfunc{long}{GetStyle}{\void}
142
143Returns the dialog style.
144
145\membersection{wxFileDialog::GetWildcard}\label{wxfiledialoggetwildcard}
146
147\constfunc{wxString}{GetWildcard}{\void}
148
149Returns the file dialog wildcard.
150
151\membersection{wxFileDialog::SetDirectory}\label{wxfiledialogsetdirectory}
152
153\func{void}{SetDirectory}{\param{const wxString\& }{directory}}
154
155Sets the default directory.
156
157\membersection{wxFileDialog::SetFilename}\label{wxfiledialogsetfilename}
158
159\func{void}{SetFilename}{\param{const wxString\& }{setfilename}}
160
161Sets the default filename.
162
163\membersection{wxFileDialog::SetFilterIndex}\label{wxfiledialogsetfilterindex}
164
165\func{void}{SetFilterIndex}{\param{int }{filterIndex}}
166
167Sets the default filter index, starting from zero. Windows only.
168
169\membersection{wxFileDialog::SetMessage}\label{wxfiledialogsetmessage}
170
171\func{void}{SetMessage}{\param{const wxString\& }{message}}
172
173Sets the message that will be displayed on the dialog.
174
175\membersection{wxFileDialog::SetPath}\label{wxfiledialogsetpath}
176
177\func{void}{SetPath}{\param{const wxString\& }{path}}
178
179Sets the path (the combined directory and filename that will be returned when the dialog is dismissed).
180
181\membersection{wxFileDialog::SetStyle}\label{wxfiledialogsetstyle}
182
183\func{void}{SetStyle}{\param{long }{style}}
184
185Sets the dialog style. See \helpref{wxFileDialog::wxFileDialog}{wxfiledialogconstr} for details.
186
187\membersection{wxFileDialog::SetWildcard}\label{wxfiledialogsetwildcard}
188
189\func{void}{SetWildcard}{\param{const wxString\& }{wildCard}}
190
6a611b39
JS
191Sets the wildcard, which can contain multiple file types, for example:
192
193``BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
a660d684
KB
194
195\membersection{wxFileDialog::ShowModal}\label{wxfiledialogshowmodal}
196
197\func{int}{ShowModal}{\void}
198
f6bcfd97 199Shows the dialog, returning wxID\_OK if the user pressed OK, and wxID\_CANCEL
a660d684
KB
200otherwise.
201
202