In Delphi 2007 and later, the global variable UseLatestCommonDialogs causes TOpenDialog to use the new Vista-style dialog on Windows Vista and 7. That’s cool.
Unfortunately, the Vista-style dialog does not seem to support the ofHideReadOnly option of TOpenDialog. The read-only checkbox never appears regardless whether this option is set to True or False.
How can I make TOpenDialog show a read-only checkbox on the Vista-style dialog?
Since this breaks backwards compatibility, I’ve reported this as a bug: QC 83606 A Delphi 2006 application that had ofHideReadOnly set to False will lose its read only checkbox when compiled without changes with Delphi 2007, 2009, or 2010 and run on Windows Vista or 7.
I’ve managed to implement this in Delphi 2010 by modifying Dialogs.pas as follows:
First, declare and implement the class
TFileOpenDialogWrapperReadOnlyEvent:Declare this string as a resource so it can be localized (if you care about that):
Then modify
TFileOpenDialogWrapper.OnExecuteEventin two steps. First, add these variable declarations:Then add this code at the end of the procedure:
Copy the new Dialogs.pas to your source code folder and delete or rename the two Dialogs.dcu files in Delphi’s
Libfolder. Recompile your app an ofHideReadOnly will work with Vista-style dialogs.