HH_TP_HELP_CONTEXTMENU
Displays a popup topic.
Argument | Description |
---|---|
hwndCaller | Handle of the control for which to show a popup |
pszFile | URL of file that contains the popup text topics. If this file is named cshelp.txt and is located in the root of the compiled helpfile then you only need to specify the helpfile. |
uCommand | HH_TP_HELP_CONTEXTMENU |
dwData | Pointer to a control id map |
Return value:
Always a handle tot he popup window but should be ignored since you can't do anything with
it. Note that a handle is returned even if the command failed. In this case a generic
popup is shown with the text "No help topic is associated with this item" and
the returned handle is the handle to this popup.
Description:
The HH_TP_HELP_CONTEXTMENU displays a context sensitive popup topic generally in
response to a WM_CONTEXTMENU message which is send when the user right clicks a control.
This command is very similar to HH_HELP_CONTEXT with the difference that this command does
not let you control the attributes of the popup window (font etc.). Furthermore it is
identical to the HH_TP_WM_HELP command.
The hwndCaller parameter should be set to the handle of the control for which you want to display a popup. The pszFile parameter specifies the URL of the file that contains the text of the popup. For example "JediHtmlHelp.chm::/cshelp.txt" specifies that the cshelp.txt file which is compiled into the helpfile named JediHtmlHelp.chm contains the text for the popups. The dwData parameter must be a pointer to a control id map. This is simply an array of DWORD values containing pairs of control id's and topic id's. The last two entries must be set to 0. In the example below the control id map (Ids) contains only one topic, it maps the handle (control id) of Button1 to a topic with topic-id 1.
As you probably expected, when HTML Help processes the HH_TP_HELP_CONTEXTMENU it searches through the control id map looking for a control id entry which matches the value of the hwndCaller parameter. If it finds a match it then extracts the topic id and looks up this topic id in the file specified by the pszFile parameter. If it finds this topic it displays the text specified. If any of these steps fails a generic topic with the text "No help topic is associated with this item" is displayed.
Example:
This exampe displays a popup from the JediHtmlHelp compiled
help (.chm) file with topic id 0. This is the topic defined in cshelp.txt as:
.TOPIC 1
This is a text string used for popup's
There are two other topics with Id 2 and 3 respectively. If you want to show any of
these topics just change assignment to Ids[1]. Note that I only specify the helpfile and
not the cshelp.txt. This is because HTML Help assumes cshelp.txt to contain the topics
when it is not specified. If I had named this file topics.txt for example or I had stored
it somewhere else but the root of my HTML Help project folder structure then I would have
had to specify this file explicitly as in: JediHtmlHelp.chm::/MySubFolder\topics.txt
procedure TForm1.Button1Click(Sender:
TObject);
var
Ids: array[0..3] of DWORD;
begin
Ids[0] := Button1.Handle;
Ids[1] := 1;
Ids[2] := 0;
Ids[3] := 0;
HtmlHelp(Button1.Handle, PChar('JediHtmlHelp.chm'),
HH_TP_HELP_CONTEXTMENU, DWORD(@Ids));
end;
Notes:
The file which contains the popup topics (e.g. cshelp.txt) must be specified in the
[FILES] section of the HTML Help project (in addition to including it in the [TEXT
POPUPS]) otherwise HTML Help will not be able to find it.
See also:
HH_TP_HELP_WM_HELP
HH_HELP_CONTEXT