Solved

Overriding onclick event for all components on form

Posted on 1997-11-16
7
348 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now