سؤال

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?

هل كانت مفيدة؟

المحلول

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;
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top