2

I was trying to add a Help button onto my Open, Save, Find and Print common dialogs in Delphi 2009.

I thought the proper way to do it was to set frShowHelp to true in the Options property of the dialog:enter image description here

But when I do, the dialog comes up the same as without the option, e.g.:enter image description here

I'm expecting to see a Help button below the Cancel button, but it's not there.

I'm developing under Windows Vista. Did Microsoft eliminate the capability of adding the Help button to their common dialogs, or am I doing something wrong?

lkessler
  • 19,819
  • 36
  • 132
  • 203
  • TFindDialog is a VCL-provided dialog, not a Microsoft common dialog; so if anything is broken, it's probably not because of Microsoft. – Joe White Oct 30 '11 at 04:15
  • That it not true. TFindDialog is a wrapper around Microsoft's Find dialog. – Remy Lebeau Oct 30 '11 at 04:22
  • See: http://msdn.microsoft.com/en-us/library/ms646956.aspx – Remy Lebeau Oct 30 '11 at 04:28
  • Correct @Remy, and this is the link to the Microsoft "Customizing Common Dialog Boxes" document that seems to indicate that the SHOWHELP value in the Flags should work. See "The Help Button" section at the bottom of the document: http://msdn.microsoft.com/en-us/library/windows/desktop/ms646951(v=vs.85).aspx – lkessler Oct 30 '11 at 05:14
  • There's something wrong here. I'm seeing the help button on my find dialogs when I set `frShowHelp`. I started with a vanilla project, added a TFindDialog, added `frShowHelp` option and invoked `FindDialog1.Execute(0)`. Help button present on D2010 and DXE2. Windows 7 x64. – David Heffernan Oct 30 '11 at 08:06
  • For the two file dialogs, the new Vista dialogs don't have built in help options. You need to implement that yourself with [`IFileDialogCustomize`](http://msdn.microsoft.com/en-us/library/bb775912.aspx) – David Heffernan Oct 30 '11 at 08:09

1 Answers1

3

Find dialog

Include frShowHelp in Options and the help button will appear. It's very hard to understand why that would not be working for you.

Print dialog

Include poHelp in Options and the help button will appear.

File dialogs

Now these did change when Vista was introduced. The new dialogs do not have, built-in, the capability to show a help button.

You can always revert to the legacy XP dialogs by setting Dialogs.UseLatestCommonDialogs to False. If you do that you can set ofShowHelp, HelpContext etc.

You should prefer to use the new dialogs if they available though. For those dialogs you need to use IFileDialogCustomize to add a help button.

In Delphi, for Vista and up, you would need to use TFileOpenDialog or TFileSaveDialog directly rather than TOpenDialog and TSaveDialog. You would create the dialog object and then request the IFileDialogCustomize interface from the Dialog property. The best place to do this is in the DoExecute event of the dialog control.

procedure TForm1.FileOpenDialog1Execute(Sender: TObject);
var
  FileDialogCustomize: IFileDialogCustomize;
begin
  FileDialogCustomize := FileOpenDialog1.Dialog as IFileDialogCustomize;
  FileDialogCustomize.AddPushButton(0, 'Help');
end;
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • I do confirm that the Help button does appear for me on the Print dialog when poHelp is added. It obviously uses a different mechanism, being poHelp instead of frShowHelp. I had tested my Find and Open dialogs for my question and assumed Save and Print would have been the same. But my Find Dialog is not showing the Help Button when I include frShowHelp. Something must be different in what I'm doing. So with that in mind, I'll research some more. – lkessler Oct 30 '11 at 15:35
  • I was able to get the Help button to appear in another project. But it my application, it won't, even with a new FindFile dialog. Still researching ... – lkessler Oct 30 '11 at 15:44
  • This is unbelievable. After I got the Help button on the Find dialog the other project. I went back to my project and tried again. To my amazement, the Help button now appears! I know it hadn't in my previous two dozen attempts. I have no idea why this fixed it. But that at least is working now. – lkessler Oct 30 '11 at 15:49