Board index » delphi » Context Sensitive Help Buttons

Context Sensitive Help Buttons

How do I get a Help Button to automatically retrieve the help context
identifier from the last active control on a Delphi form ?

eg If I'm in an edit field and I press F1, then Delphi resolves the help
context identifier for me. How do I achieve the same thing using a
dedicated help button ?

ta

 

Re:Context Sensitive Help Buttons


Quote
Scott Simms wrote:

> How do I get a Help Button to automatically retrieve the help context
> identifier from the last active control on a Delphi form ?

> eg If I'm in an edit field and I press F1, then Delphi resolves the help
> context identifier for me. How do I achieve the same thing using a
> dedicated help button ?

> ta

If you are developping a MDI application, try first to find the active
child with:
                                        ActiveMDIChild,
Or if you have a SDI application:       ActiveControl,

this will give you the current active child,

Then browse in VCL sources to retrieve the HELP identifier and call the
function:
     WinHelp (handle, HelpFile, Help_Context, IdH); { see WinAPI Help
file }

Hope this help,
        Philippe.

  +---------------------------------------------------------+
  |   Virtual Micro Design                                  |
  |                                                         |
  | E-Mail:  p.tec...@idls.izarbel.tm.fr                    |
  | WEB:     http://idls.izarbel.tm.fr/entp/techer/P01.HTM  |
  +---------------------------------------------------------+

Re:Context Sensitive Help Buttons


<How do I get a Help Button to automatically retrieve the help context
identifier from the last active control on a Delphi form ?>
Don't think there's an automatic way to do this.

Seems like the following would work but I've never tried it. Say I have a
TEdit called Edit1 and a TButton called HelpButton,

Edit1.Exit
begin
 HelpButton.HelpContext := Edit1.HelpContext;
end;

Then, when your user presses the Help button, the correct HelpContext is
called.

Hope this helps.
Brad
Brad
DBradDa...@aol.com

Re:Context Sensitive Help Buttons


Scott,
  The following should work (I only tried it under Delphi 1.0).  Use a
SpeedButton for your help button so that the focus does not change when you
click on it (I named it HelpButton).

procedure TForm1.HelpButtonClick(Sender: TObject);
begin
  Application.HelpContext(ActiveControl.HelpContext);
end;

Hope this helps!
--
Rod Geraghty (:>)
GERA-Tech
Ottawa, Canada
gera...@ibm.net

Scott Simms <n...@swannet.com.au> wrote in article
<01bc5ebe$ddab00a0$d54b6...@swannet.com.au>...

Quote
> How do I get a Help Button to automatically retrieve the help context
> identifier from the last active control on a Delphi form ?

> eg If I'm in an edit field and I press F1, then Delphi resolves the help
> context identifier for me. How do I achieve the same thing using a
> dedicated help button ?

> ta

Other Threads