Jump to content
pyscripter

Html Help: Ctrl+F not working

Recommended Posts

In my Delphi apps, I use the dated CHM Html Help format to provide user help.   When help is invoked from the Delphi app using the Application help commands, Ctrl+F to search within a help page does not work.  However, if open the same chm file outside the Delphi app, Ctrl+F works fine.  Any clues as to what causes this issue?

 

Note: The Delphi app is compiled with Alexandria (v11) and I am testing on Windows 11. 

Edited by pyscripter

Share this post


Link to post
20 minutes ago, programmerdelphi2k said:

it would be because "Ctrl+F" is a "Search on Editor-code"?

Thanks for responding.  No, it is not that.   I have tested with a new minimal app, just a form and a button to open the help file, and the issue still exists.  I think it used to work with earlier versions of Windows/Delphi.

Edited by pyscripter

Share this post


Link to post

hy @pyscripter

 

here Ctrl+F works, but ONLY if you focus is "right side" on help screen... not in "left side = tree menu"

...
function MyOnHelp(Command: Word; Data: THelpEventData; var CallHelp: Boolean): Boolean;
...

procedure TForm1.FormCreate(Sender: TObject);
begin
  LFileCHM             := ExtractFilePath(Application.ExeName) + 'data.chm';
  Application.HelpFile := LFileCHM;
  Application.OnHelp   := MyOnHelp;
end;

function TForm1.MyOnHelp(Command: Word; Data: THelpEventData; var CallHelp: Boolean): Boolean;
begin
  result := true;
   // HH.exe is the browser used by RAD, including you can config it! on prompt type: hh /?  -> show the Explorer files!
  ShellExecute(0, 'open', 'hh.exe', PWideChar(LFileCHM), nil, SW_SHOW);
  CallHelp := False;
end;

 

Edited by programmerdelphi2k

Share this post


Link to post
5 hours ago, programmerdelphi2k said:

here Ctrl+F works

Which Delphi version?

Which Windows version?

 

Could you please try using the Delphi way?

  • Add   Vcl.HTMLHelpViewer to the dpr uses clause
  • Set Application.HelpFile = to your chm file
  • Use the Application Help commands to invoke help (e.g. Application.HelpShowTableOfContents. Application.HelpContext etc.)
Edited by pyscripter

Share this post


Link to post

I have just noticed that Ctrl+F does not work in my Desktop Delphi 11.2 help files.  (Windows 11 22H2).   But it works in my laptop, which is also Windows 11 22H2.  Strangely Ctrl+F does not work with PyScripter help on either the Desktop or the Laptop.   Weird.

Share this post


Link to post

Hi,
I confirm that both CTRL+F and CTRL+C do not work under Delphi Alexandria + Win11 64b.
Not working is:

HtmlHelp(0, Application.HelpFile, HH_DISPLAY_TOC, 0);
HtmlHelp(0, Application.HelpFile, HH_DISPLAY_INDEX, DWORD(PWideChar('')));
HtmlHelp(0, Application.HelpFile, HH_DISPLAY_SEARCH, DWORD(@Query));
Application.HelpContext()

Calling HtmlHelpW instead of HtmlHelp works.
A broken Application.HelpContext solved them like this:

function TFormMain.ApplicationEvents1Help(Command: Word; Data: NativeInt;
   var CallHelp: Boolean): Boolean;
begin
	HtmlHelpW(0, PWideChar(Application.HelpFile), HH_HELP_CONTEXT, Data);
	CallHelp := False;
end;

I used HH_HELP_CONTEXT because even when calling the Application.HelpContext the Command parameter contained 1 instead of 15.

Of course, this solution does not work if HelpKeyword is used for components.

A universal solution could be made by possibly recoding these constants.

const
  { Commands to pass to WinHelp() }
  {$EXTERNALSYM HELP_CONTEXT}
  HELP_CONTEXT = 1;       { Display topic in ulTopic  }
  {$EXTERNALSYM HELP_QUIT}
  HELP_QUIT = 2;          { Terminate help  }
  {$EXTERNALSYM HELP_INDEX}
  HELP_INDEX = 3;         { Display index  }
  {$EXTERNALSYM HELP_CONTENTS}
  HELP_CONTENTS = 3;
  {$EXTERNALSYM HELP_HELPONHELP}
  HELP_HELPONHELP = 4;    { Display help on using help  }
  {$EXTERNALSYM HELP_SETINDEX}
  HELP_SETINDEX = 5;      { Set current Index for multi index help  }
  {$EXTERNALSYM HELP_SETCONTENTS}
  HELP_SETCONTENTS = 5;
  {$EXTERNALSYM HELP_CONTEXTPOPUP}
  HELP_CONTEXTPOPUP = 8;
  {$EXTERNALSYM HELP_FORCEFILE}
  HELP_FORCEFILE = 9;
  {$EXTERNALSYM HELP_KEY}
  HELP_KEY = 257;         { Display topic for keyword in offabData  }
  {$EXTERNALSYM HELP_COMMAND}
  HELP_COMMAND = 258;
  {$EXTERNALSYM HELP_PARTIALKEY}
  HELP_PARTIALKEY = 261;
  {$EXTERNALSYM HELP_MULTIKEY}
  HELP_MULTIKEY = 513;
  {$EXTERNALSYM HELP_SETWINPOS}
  HELP_SETWINPOS = 515;
  {$EXTERNALSYM HELP_CONTEXTMENU}
  HELP_CONTEXTMENU = 10;
  {$EXTERNALSYM HELP_FINDER}
  HELP_FINDER = 11;
  {$EXTERNALSYM HELP_WM_HELP}
  HELP_WM_HELP = 12;
  {$EXTERNALSYM HELP_SETPOPUP_POS}
  HELP_SETPOPUP_POS = 13;
const

{$EXTERNALSYM   HH_DISPLAY_TOPIC      }
  HH_DISPLAY_TOPIC      = 0;
{$EXTERNALSYM   HH_HELP_FINDER         }
  HH_HELP_FINDER         =    0;
{$EXTERNALSYM   HH_DISPLAY_TOC         }
  HH_DISPLAY_TOC         =    1;
{$EXTERNALSYM   HH_DISPLAY_INDEX       }
  HH_DISPLAY_INDEX       =    2;
{$EXTERNALSYM   HH_DISPLAY_SEARCH      }
  HH_DISPLAY_SEARCH      =    3;
{$EXTERNALSYM   HH_SET_WIN_TYPE        }
  HH_SET_WIN_TYPE        =    4;
{$EXTERNALSYM   HH_GET_WIN_TYPE        }
  HH_GET_WIN_TYPE        =    5;
{$EXTERNALSYM   HH_GET_WIN_HANDLE      }
  HH_GET_WIN_HANDLE      =    6;
{$EXTERNALSYM   HH_ENUM_INFO_TYPE      }
  HH_ENUM_INFO_TYPE      =    7;
{$EXTERNALSYM   HH_SET_INFO_TYPE       }
  HH_SET_INFO_TYPE       =    8;
{$EXTERNALSYM   HH_SYNC                }
  HH_SYNC                =    9;
{$EXTERNALSYM   HH_KEYWORD_LOOKUP      }
  HH_KEYWORD_LOOKUP      =   $d;
{$EXTERNALSYM   HH_DISPLAY_TEXT_POPUP  }
  HH_DISPLAY_TEXT_POPUP  =   $e;
{$EXTERNALSYM   HH_HELP_CONTEXT        }
  HH_HELP_CONTEXT        =   $f;
{$EXTERNALSYM   HH_TP_HELP_CONTEXTMENU }
  HH_TP_HELP_CONTEXTMENU =  $10;
{$EXTERNALSYM   HH_TP_HELP_WM_HELP     }
  HH_TP_HELP_WM_HELP     =  $11;
{$EXTERNALSYM   HH_CLOSE_ALL           }
  HH_CLOSE_ALL           =  $12;
{$EXTERNALSYM   HH_ALINK_LOOKUP        }
  HH_ALINK_LOOKUP        =  $13;
{$EXTERNALSYM   HH_GET_LAST_ERROR      }
  HH_GET_LAST_ERROR      =  $14;
{$EXTERNALSYM   HH_ENUM_CATEGORY       }
  HH_ENUM_CATEGORY       =  $15;
{$EXTERNALSYM   HH_ENUM_CATEGORY_IT    }
  HH_ENUM_CATEGORY_IT    =  $16;
{$EXTERNALSYM   HH_RESET_IT_FILTER     }
  HH_RESET_IT_FILTER     =  $17;
{$EXTERNALSYM   HH_SET_INCLUSIVE_FILTER }
  HH_SET_INCLUSIVE_FILTER = $18;
{$EXTERNALSYM   HH_SET_EXCLUSIVE_FILTER }
  HH_SET_EXCLUSIVE_FILTER = $19;
{$EXTERNALSYM   HH_INITIALIZE          }
  HH_INITIALIZE          =  $1c;
{$EXTERNALSYM   HH_UNINITIALIZE        }
  HH_UNINITIALIZE        =  $1d;
{$EXTERNALSYM   HH_SET_QUERYSERVICE    }
  HH_SET_QUERYSERVICE    =  $1e;
{$EXTERNALSYM   HH_PRETRANSLATEMESSAGE }
  HH_PRETRANSLATEMESSAGE =  $fd;
{$EXTERNALSYM   HH_GLOBALPROPERTY      }
  HH_GLOBALPROPERTY      =  $fc;

 

Edited by iqrf
  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×