Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Triggering the Application.OnHelp event in Delphi 7

120 views
Skip to first unread message

Adlib

unread,
Jan 16, 2004, 1:05:11 PM1/16/04
to
Hello,

Does anyone know how to get the Application.OnHelp event to fire in Delphi7?
My code currently looks like this:

procedure TfrmGui.FormCreate(Sender: TObject);
begin
sAppDir:=Extractfilepath(Application.Exename);
Application.Helpfile:=sAppDir+'Help.chm';
Application.OnHelp:=FormHelp;
end;

function TfrmGui.FormHelp(Command: Word; Data: Integer; var CallHelp:
Boolean): Boolean;
var sBase:string;
begin
sBase:='mk:@MSITStore:'+sAppDir+'Help.chm'+::/Help Pages/';
Execute('hh.exe',sBase+'test topic.htm',sw_shownormal);
CallHelp:=false;
end;

Premise: Delphi supports .hlp help, but not .chm help - so I'm intercepting
the help event and calling HTML Help manually.

My Execute function is just a wrapper for ShellExecute. The application
controls have a HelpKeyword assigned in the Object Inspector, and the
HelpType property is set to htKeyword.
Eventually I hope to replace 'test topic.htm' with the htKeyword value
obtained through the passed Data variable. At least I think I read
somewhere that 'Data' can hold a pointer to the htKeyword string. Would be
really nice if OnHelp passed htKeyword as a string, or the object e.g.
Sender: TObject instead.

But at the moment I can't even get the OnHelp routine to fire in response to
F1 on the keyboard. Anyone help?


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.554 / Virus Database: 346 - Release Date: 20/12/2003

Ignacio Vazquez

unread,
Jan 16, 2004, 12:53:55 PM1/16/04
to
Adlib wrote:

> But at the moment I can't even get the OnHelp routine to fire in
> response to F1 on the keyboard. Anyone help?

Did you set the Help* properties of the test control?

--
Cheers,
Ignacio

Help improve Delphi: http://qc.borland.com/

Adlib

unread,
Jan 16, 2004, 2:26:04 PM1/16/04
to
Yes, in the Object Inspector, on the test control I have set :

HelpKeyword | Test
HelpType | htKeyword

Is that what you meant - or do I need to set something else too?

----

"Ignacio Vazquez" <ivazquezATorioncommunications.com> wrote in message
news:4008...@newsgroups.borland.com...

Ignacio Vazquez

unread,
Jan 16, 2004, 2:20:49 PM1/16/04
to
Adlib wrote:

> Is that what you meant - or do I need to set something else too?

No, that's exactly what I meant.

That part's fine, so hmm...

Do you have a handler assigned to TForm.OnHelp?

Martijn Tonies

unread,
Jan 16, 2004, 2:38:13 PM1/16/04
to
Hi,

> Does anyone know how to get the Application.OnHelp event to fire in
Delphi7?
> My code currently looks like this:
>
> procedure TfrmGui.FormCreate(Sender: TObject);
> begin
> sAppDir:=Extractfilepath(Application.Exename);
> Application.Helpfile:=sAppDir+'Help.chm';
> Application.OnHelp:=FormHelp;
> end;
>
> function TfrmGui.FormHelp(Command: Word; Data: Integer; var CallHelp:
> Boolean): Boolean;
> var sBase:string;
> begin
> sBase:='mk:@MSITStore:'+sAppDir+'Help.chm'+::/Help Pages/';
> Execute('hh.exe',sBase+'test topic.htm',sw_shownormal);
> CallHelp:=false;
> end;
>
> Premise: Delphi supports .hlp help, but not .chm help - so I'm
intercepting
> the help event and calling HTML Help manually.

I believe you need a fix for this.

I've posted it to the borland.public.attachments group.

I cannot remember where I got it, but I'm pretty sure it's freeware.


--
With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com


Adlib

unread,
Jan 16, 2004, 4:11:58 PM1/16/04
to
Many thanks! - I think that's what I was looking for :-)

---

"Martijn Tonies" <m.tonies@upscene!nospam!.com> wrote in message
news:40083d43$1...@newsgroups.borland.com...

>
> I believe you need a fix for this.
>
> I've posted it to the borland.public.attachments group.
>
> I cannot remember where I got it, but I'm pretty sure it's freeware.
>
>
> --
> With regards,
>
> Martijn Tonies
> Database Workbench - developer tool for InterBase, Firebird, MySQL & MS
SQL
> Server.
> Upscene Productions
> http://www.upscene.com
>
>

0 new messages