Board index » delphi » questionmark button & context sensitive help

questionmark button & context sensitive help

Dear Delphians,

When you click on the questionmark button, the mouse cursor becomes a
question mark with an arrow. This indicates that the application has
switched to context sensitive help mode. When you click on a control with
this help cursor, Delphi displays the help topic for it (if there is a
matching help topic). So it should be, but not always is...

I did all according to the rules: When using F1 I set BorderIcons to
[biSystemMenu], while when using the questionmark button I set BorderIcons
to [biSystemMenu,biHelp], BorderStyle = bsDialog in both cases. The F1
worked perfectly well, but I wanted the help topic being displayed in a
popup window, not in a standard help window. So I changed BorderIcons values
and assigned the help context number to the proper control. And nothing
happened! Sure, I got the questionmark button click on the window caption, I
was clicking on it, every time I did it the cursor became a question mark
with an arrow, but when I clicked on the proper control - NOTHING HAPPENED!
I'm pretty sure that the help mode was not being activated at all, because
the forms OnHelp event was being raised only when using F1 but  not when
using the questionmark button (I had written a dummy OnHelp handler just to
check if the event was raised).

So I wrote an OnClick handler for the control with only one command:
Application.HelpCommand(HELP_CONTEXT,TopicNumber) and went back to the
window with no questionmark button. And it worked, generating an OnHelp
event and displaying the standard help window. Yet when I changed
HELP_CONTEXT to HELP_CONTEXTPOPUP to get a popup window it stoped working!

Then I put the questionmark button on the window again and changed the
command by making it depend on the cursor:
if Cursor = crHelp then
    Application.HelpCommand(HELP_CONTEXT,TopicNumber)
But though the cursor on the screen realy turned to a question mark with an
arrow, the cursors value did not change, the command was never put in
action. And no help window was displayed. Isn't this crazy?!

I just want the context sensitive help on my window with no tricks, just
using the functionality of Delphi 5, that is what I had paid for, isn't
that? Could you, please, tell me, what I'm doing wrong?

Wojtek Niwinski
wojt...@swipnet.se

PS Please, mail the answer to my address as well.

 

Re:questionmark button & context sensitive help


Moze powinienem dodac, ze chodzi o okno wyswietlane modalnie i ze jest to
komponent zawarty w bibliotece DLL.

Wojtek Niwinski
wojt...@swipnet.se

Re:questionmark button & context sensitive help


Perhaps I should mention that the form is a modal one and it si included
into a dll-library.

Wojtek Niwinski
wojt...@swipnet.se

Re:questionmark button & context sensitive help


Quote
> When you click on the questionmark button, the mouse cursor becomes a
> question mark with an arrow. This indicates that the application has
> switched to context sensitive help mode. When you click on a control with
> this help cursor, Delphi displays the help topic for it (if there is a
> matching help topic). So it should be, but not always is...

The built-in context sensitive help mode only works with TWincontrols that
have a window handle. That's nothing Delphi can change easily, but a Windows
limitation. Delphi responds to a WM_HELP message that is sent by Windows to
the clicked control. As non-windowed controls such as TSpeedbuttons, TShapes
and TImages do not have a window handle, no WM_HELP message is sent at all
and therefore nothing happens.

Also, no WM_HELP message is sent when you click the form directly.

The difference to the F1 key is obvious: when you press F1, some control has
the focus and this is always a TWinControl with a window handle that gets
the WM_HELP message.

Check out our tutorial "All about help files in Borland Delphi" for more
information on context sensitive help:
http://www.ec-software.com/tutorial.htm
--

Alexander Halser
+++++++++++++++++++++++++++++++++++++++
http://www.ec-software.com
Help & Manual - the next generation in help authoring

Re:questionmark button & context sensitive help


Thank you, Alexander, for being kind to come with some comments to my
letter.

My problem was not related to non-windowed controlls but to windowed ones.
By the way, I have partially solved it. The reason why it didn't work was
that the form with the questionmark button was generated by a dll. As such
it had no owner. Now I call the dll and send to it a handle belonging to the
application that is using it. So it works now. But...

But actually this dll will be used with a program written by someone else in
Visual Basic. The combination - the other program and my own dll-modul,
works as it is supposed to except the help thing. The mouse cursor becomes a
question mark with an arrow, yet when one clicks on a control (TEdit), no
help topic is being displayed. I blame it on the fact that the VB
application doesn't have same built-in functionality as Delphi applications
have. Do you also believe that it's so?

Well, I can solve the problem by using the F1 key instead, but this will
generated those awkward help windows with plenty of buttons that nobody need
in this particular case. The need of help in my moduls is very limited, so
there is no need to use a full apparatus for help system. I could of course
use OnClick events and write some code for showing help in ordinary windows,
but I'm very fond of those pop-up windows, the way they look and their
ability to adapt their size to the size of message included. Do you have any
idea what shall I do?

Quote
> Check out our tutorial "All about help files in Borland Delphi" for more
> information on context sensitive help:

I already did it. It's excellent!

Wojtek

"Alexander Halser" <halserATec-software....@nospam.com> skrev i meddelandet
news:398fd4e3$1@news.salzburg.co.at...

Quote
> > When you click on the questionmark button, the mouse cursor becomes a
> > question mark with an arrow. This indicates that the application has
> > switched to context sensitive help mode. When you click on a control
with
> > this help cursor, Delphi displays the help topic for it (if there is a
> > matching help topic). So it should be, but not always is...

> The built-in context sensitive help mode only works with TWincontrols that
> have a window handle. That's nothing Delphi can change easily, but a
Windows
> limitation. Delphi responds to a WM_HELP message that is sent by Windows
to
> the clicked control. As non-windowed controls such as TSpeedbuttons,
TShapes
> and TImages do not have a window handle, no WM_HELP message is sent at all
> and therefore nothing happens.

> Also, no WM_HELP message is sent when you click the form directly.

> The difference to the F1 key is obvious: when you press F1, some control
has
> the focus and this is always a TWinControl with a window handle that gets
> the WM_HELP message.

> Check out our tutorial "All about help files in Borland Delphi" for more
> information on context sensitive help:
> http://www.ec-software.com/tutorial.htm
> --

> Alexander Halser
> +++++++++++++++++++++++++++++++++++++++
> http://www.ec-software.com
> Help & Manual - the next generation in help authoring

Other Threads