microsoft.com/en-us/library/ms646949.aspx
# You can find the header file with the full list of constants
# here:
# http://doc.ddart.net/msdn/header/include/commdlg.h.html
OFN_HIDEREADONLY = 0x0004
OFN_PATHMUSTEXIST = 0x0800
OFN_FILEMUSTEXIST = 0x1000
filetype_filter =[['Access Database (*.mdb)','*.mdb'],
['All files (*.*)', '*.*']]
database_path = SWin::CommonDialog::openFilename(
nil,
filetype_filter,
OFN_HIDEREADONLY |
OFN_PATHMUSTEXIST |
OFN_FILEMUSTEXIST,
'Choose a database')
exit if database_path.nil?
end
CHAPTER 12 n CREATING REPORTS WITH RUBY AND MICROSOFT OFFICE 256
If no database was passed, a Windows common dialog box is displayed, asking the
user to choose a database file. This is achieved using the SWin::CommonDialog::
openFilename method, which has the following parameters:
Parent window: Since you don??™t have any windows in this example, the parent window
parameter is nil. In this case, having no owner window won??™t change anything.
If you??™re interested in the cases where it does, you can read the gory details at
http://msdn2.
Pages:
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365