Delphi 2007 - New Vista dialogs
random ramblings on Delphi, programming, Delphi programming, and all the rest
Delphi 2007 supports new-style Open/Save dialogs on Vista, allows you to configure new features in those dialogs and does it in a way that's compatible with older applications. Sadly, it only does two out of three things at once (admittedly, even that is a lot and more would be a pure magic).
If you know you'll be running on Vista, you can use new TFileOpenDialog (or TFileSaveDialog - everything I'll tell you about Open dialog holds also for Save dialog) which exposes new properties, such as FavoriteLinks and OkButtonLabel, and new options. But if you'll try to open this dialog on pre-Vista Windows, you'll only get an error message. (Still, that app will load fine up to the point when you actually try to display the dialog, so it is entirely possible to code two paths in your application, one using TFileOpenDialog if OS is Vista and another using TOpenDialog in all other cases.)
If you use TOpenDialog, you'll get an old-shool dialog, but it will work on all Windows.
And then there's a third possibility - you can use TOpenDialog while setting the global variable UseLatestCommonDialogs (declared in Dialogs.pas) to True. In that case, TOpenDialog will use new-style dialog on Vista and old-style dialog on older Windows. However, you'll not be able to specify any new Vista-only properties (like the OkButtonLabel I mentioned above).
In visual summary, your options are:
Besides file open/save dialogs, Delphi 2007 includes support for task dialogs. TTaskDialog components allows for simple creation of task dialogs, together with icons, expanded section, progress bar etc. Of course, it will only work on Windows Vista.
[I'm blogging about Spacely - the beta version of Delphi 2007 for Win32 - with special permission given from CodeGear.]