I have a project that will soon be finished I'm getting all my help
documentation ready for.  I decided it would be cool in this case, being
that it's a very complicated application and the systems manager doesn't
have time to instruct everyone separately, if instead of just normal hints
that popup when ever the mouse pointer hovers over a control, a user config
option would be available that could be used by each independent user to
turn either the normal short hints or very detailed long help hints on.
Either that or provide a key down combination along with the mouse pointer
hovering that cause the long help hint to display.  But I'm having a problem
setting this up!
        I have Application.showHints := True; in my mainform's OnCreate or
would it be better to put this in the dpr?  I don't know that it matters.
In any case however, I added an ApplicationEvents component to my mainform
and set up a handler for the OnShowhint event as per the help file's
instructions.  The code I wrote in it checks an ini-file Boolean setting to
decide if it should show a regular short hint or the Long help hint like so:

if ThisAppIni.ReadBool(AppUserName, 'HelpHintsOn', True) = True then
    begin
        GetlongHint(Hintinfo.HintStr)
    end
    Else
    begin
        GetShortHint(Hintinfo.HintStr);
    end;

And as you can see, the default setting assumes a new user and so turns the
Long help hints on.  Then in each other form's OnCreate I've added code
which sets the short and long hints string for every TAction, since every
control I want this to work with is connected to an Action anyway.  For
example, here's the code for an action that both a button and menu item on a
secondary form is connected to:

InfoAct.Hint := Form2HintStrs.Strings[0];

        Now "Form2HintStrs" is a non-visual component found in the Jvcl
which is really nothing more than a TStrings container class.  It has a
property editor which allows you to pre-initialize the strings being stored
by the container.  I could more easily just add the hint str to the Action's
hint property, however using a container like this will make it easier later
on if and when I decide to add additional language strings.  Here's what the
string at index[0] looks like:

'View, Add, Edit Information|If button is Lime Green then you may click to
view available Information, otherwise click while SHIFT key is held down to
Add or Edit Information!'

        As per the help file again, the short, normally shown hint is the
first string and the second string, separated from the first by a '|'
vertical line, is the one that will be shown by a call to the function,
GetLongHint();

        It compiles fine, but when I put my mouse pointer over the button
the short hint shows up instead of the long hint!  This doesn't make any
sense because the Boolean read from the inifile is true by default, and when
true, the LongHint should be called!
        What is it I'm doing wrong here and/or is there a simpler way to
handle something like this?  I know the problem must be a simple one, but I
just haven't been able to put my finger on it!    

from Robert Meek dba Tangentals Design  CCopyright 2006
Proud to be a moderator of "The Delphi Lists" at elists.org

"When I examine myself and my methods of thought, I come to the conclusion
that the gift of Fantasy has meant more to me then my talent for absorbing
positive knowledge!"
                                                    Albert Einstein



_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to