Solved

Overriding onclick event for all components on form

Posted on 1997-11-16
7
353 Views
Last Modified: 2010-04-04
How do I override the onclick event for all the components on a form, without having to hardcode each event?
I can override the onclick for the form, but not inherited by all the components on the form. I want to implement a help cursor, Word style, that when clicked changes the cursor to crHelp, and then while the cursor is in this state, I want it to give the component focus when clicked, and then execute an F1 keypress, but not execute the standard onclick event for that component.

Ive tried the following for Form1
type
THelpForm = class(TForm)
procedure Click; override;
end;

type Form1 = class(THelpForm)....
end;

procedure THelpForm.Click;
begin
  if Screen.Cursor = crHelp then
     Form1.Edit1.text := 'HELP'
  else
  inherited Click;      { perform standard handling, including calling handler }
end;

Well this works just fine for the form itself, but not for the buttons on the form etc... and I don't want to have to hardcode every button on the forms onclick event... Is it possible for the m to inherit this click override!!
0
Comment
Question by:doogie
  • 4
  • 3
7 Comments
 
LVL 4

Expert Comment

by:itamar
ID: 1350638
Delphi already has this kind of help implementation.
Do you know this and don't want to use, or would you like some information about that ?
0
 

Author Comment

by:doogie
ID: 1350639
I know Delphi has context sensitive help on the F1 key, but not on the left mouse button as far as I know, and not with the cursor crHelp.
I also need to use HTML help and not the standard help API that Delphi understands

So my question still stands as is!
0
 
LVL 4

Expert Comment

by:itamar
ID: 1350640
Just for your information:
Delphi also has context sensitive help on the left mouse button including the activation by the interrogation mark button on top of the form, changing the cursor (crHelp) automatically and opening a help window based on the help context of every object in the form (just like Word does).
But... it doesn't understand the very new HTML help. Perhaps when it becomes standard in Win98, who knows...
So my comment still stands as is!
0
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

Author Comment

by:doogie
ID: 1350641
Well well, never too old to learn. Thanks for that.
Let me in on how the context help is activated using the left mouse button, and please tell me about the 'interrogation button' and all the points are yours!!...seeing as that is exactly what I require... I know how to get the HTML help to work.
Code eg will be appreciated. I'll also revisit the documentation... If you are using a thirdparty VCL please let me know
Thanks !!!
0
 
LVL 4

Accepted Solution

by:
itamar earned 100 total points
ID: 1350642
Hey ! I hope you're using Delphi 2 !
It's not a third-party VCL, it's just in the Form !!!

Ok, no more mistery...

You must make your app help exactly the same way to use the F1 context help.
In the form you want to use the left mouse button you must set the following properties as this:

+BorderIcons
  biMinimize = False
  biMaximize = True
  biHelp = True

And that's all...
Observe that this kind of help (pop-up windows) doesn't work with Minimizeable and/or maximizeable forms. It's not a limitation of Delphi. It's a Windows standard (believe me !).

By the way, take a look at the OnHelp event of TApplication, perhaps it can be usefull on HTML helps.

I hope this helps,

Itamar
0
 

Author Comment

by:doogie
ID: 1350643
Itamar....
Well now I have the real answer, not the answer to the question that arose from the question. You got the 100 points for answering the second question, but here is the real answer from Peter Below (Team B) Borland.public.delphi.winapi newsgroup.


>SendMessage(Form1.handle,WM_SYSCOMMAND,SC_CONTEXTHELP,0);
>
>PS Peter this works just fine.. will look into the help for speed
>buttons as you recommended!
>And yes it does change the cursor to crHelp.
>The BorderIcons property allows one to set biHelp, but then the form
>defaults to a dialog form...this way the form is still resizeable, and
>also works with HTML help using  components from Hyperact.
>

0
 
LVL 4

Expert Comment

by:itamar
ID: 1350644
It's a good answer indeed, but the original question was:

"How do I override the onclick event for all the components on a form, without having to hardcode each event?" (Remember that ?)

Does Peter's code do that ??

Let me refresh Peter's answer:

"Adrian,

you are going at this problem from the wrong angle, i think. If you go into help context mode ..."

What Peter's code does is exactly the same of biHelp with the clear advantage of a minimizeable form, but it is not Windows 95 standard (Who cares ?)

I think it's important to make things clear. That's why i put this comment.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
TVirtualStringTree  search using TEdit 7 121
indy Tmemory stream non latin charcter issue 2 110
select query - oracle 16 100
Tvertscrollbox like a whatsapp layout 5 27
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question