0

Office 2010 has a new type of ribbon, the backstage view. This has been implemented in MFC using Codejock Xtreme Toolkit Pro V15.0.1.

The thing is that I feel that the File>Open and File>SaveAs act very strange in Office. They open a modal file open dialog instead of opening an embedded file open dialog in the backstage, which would (IMHO) feel much more natural.

I cannot find a way of doing this in C++ using MFC or Win32. The only thing I found was this question, but that was for Delphi.

So, is it possible to embed the standard Windows File Open dialog as a control in another dialog? Or do I need to implement the entire thing myself?

Community
  • 1
  • 1
dalle
  • 18,057
  • 5
  • 57
  • 81
  • I doubt that this can be done. As an aside, the Office team were derided for years and years for using their own file dialog rather than the system dialog. It wasn't until Office 2007 that they fell into line and used the system dialog. The use of the system dialog is a good thing in my view but I can see how embedding inside backstage could feel cleaner. – David Heffernan Oct 17 '11 at 10:19

2 Answers2

2

To the best of my knowledge, The standard Open/Save dialog functionality is exposed through the modal dialog only (through the GetOpenFilename Win32 API).

There is a standard mechanisme to customise the dialog (See Skizz answer) but it remains a modal dialog. One case of advanced customisation was the VB6 Open Project dialog:

enter image description here

The Existing tab contains a file dialog. How did they do it? I mean, how did they manage to put a standard dialog into a page of their 3-tabs property sheet?

It appears that they simply used the standard customization dialog and added a tab control above the standard dir/file controls and listview for other 'tabs' above dir/file controls. These dir/file controls were then hidden by the custom code when a tab other than Existing was clicked. You get it: no real tabs! Just a good old file dialog where the main controls may be hidden in favor of other ones.

So my short answer is: You're pretty much out of luck using the dialog as a child control.

Now, to come back to Office: I believe it's better to keep a modal dialog. It would otherwise be confusing to user: Is the path that I started to type the real path of did I just clicked 'Home' and let the save command unfinished?

Community
  • 1
  • 1
Serge Wautier
  • 21,494
  • 13
  • 69
  • 110
  • As per my comment to Skizz's answer, all this information is now way out of date following the Vista introduction of `IFileDialogCustomize`. – David Heffernan Oct 17 '11 at 10:58
  • 1
    @David: Good to know about IFileDialogCustomize but, besides the fact that according to various reports such as [this one](http://www.w3schools.com/browsers/browsers_os.asp), XP is still in use on 35% of computers, how does this new customisation mechanism obsolete my answer? Does it allow to embed the file dialog as asked by the OP? – Serge Wautier Oct 17 '11 at 11:19
  • It makes it incomplete. Any customisation of file dialogs needs to be implemented with both methods until you are prepared to abandon support for XP. What's more the customisation afforded by `IFileDialogCustomize` is far less flexible than offered by the old style XP dialogs. So the screenshot you showed would simply not be viable with the new dialogs. Certainly no change to embed using `IFileDialogCustomize`. Whilst you can continue with XP style customisation the result is the revolting legacy dialogs. – David Heffernan Oct 17 '11 at 11:58
1

I don't know if you can embed a file open dialog into another dialog, but you can certainly extend the existing dialogs:-

Here's one implementation.

And another.

And an MSDN version.

Thanks to David for pointing out the above are a bit out of date, so, after a quick Google, here's a more modern take on extending the file dialogs (and lots of other stuff as well).

Skizz
  • 69,698
  • 10
  • 71
  • 108
  • All these links are out of date. The game changed completely when Vista was released. `IFileDialogCustomize` is the new way to do this. – David Heffernan Oct 17 '11 at 10:58