Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Refreshing appearance of a hint

Posted on 1998-09-04
Medium Priority
Last Modified: 2010-04-04
Hello everybody,

   When the cursor is over a control, it displays a hint if ShowHint is true (and there is a hint!). Once the hint has disappeared (the hint timer has expired), it will not reappear until the mouse leaves the control and returns over it to prompt it once again. I have a listbox where I do some fancy hint manipulation according to the index that the mouse point is over. I would like to see the hint reappear every time the mouse stops moving for a moment. With this in mind, I would like a solution that does not involve tricks which I can come up with myself: I want to know what message I can send the listbox, or what I should override in my own custom TAlwaysDisplayHintEvenWhenHintHasAlreadyShown so that this will work.

Regards, and have a particularly good day.

Question by:Edo082297
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2

Expert Comment

ID: 1338633
Hi Edo,

 I'm not sure if it's the same for your case, but if you want to change the appereance of the Hint, you've to make a descendant of THintWindow. I propose that you have a look at its properties etc. There are also a lot of free-source-codes on Torry's, DSP, etc.

 If you still need some more help after that, just ask and I'll help you when I'm back (if I can offcourse), perhaps somebody else can already help you before.

regards, Zif.

Author Comment

ID: 1338634
Hiya Brad,
  No, I'm happy with the physical appearance of the hint. It's just that the control occupies a large part of the form, and I want the hint to keep reappearing when the mouse hovers over an item in it, and not just once as when the mouse goes over the control and then remains within its constituent rect.


Expert Comment

ID: 1338635
Then, you've to recall the hint again. Or make a descendant that displays longer then the normal hint.

here is a code to let the hint appear and remove it manually :
Is it possible to call the  Hint method directly?
I've a case where I want to click on a Button, and the Hint for
another component (eg, an edit box) will appear for 1 second or
so, and then it will disappear after the button is released. I
saw something like "ActivateHint" but it seemed that I
couldn't make a direct call.
 function RevealHint (Control: TControl): THintWindow;
{ Pops up Hint window for the specified Control, and returns a   }
{ reference to the hint object so it may subsequently be removed }
{ with RemoveHint (see below).                                   }
   ShortHint: string;
   AShortHint: array[0..255] of Char;
   HintPos: TPoint;
   HintBox: TRect;
   { Create the window: }
   Result := THintWindow.Create(Control);

   { Get first half of hint up to '|': }
   ShortHint := GetShortHint(Control.Hint);

   { Calculate Hint Window position & size: }
   HintPos := Control.ClientOrigin;
   Inc(HintPos.Y, Control.Height + 6);    <<<< See note below
   HintBox := Bounds(0, 0, Screen.Width, 0);
       StrPCopy(AShortHint, ShortHint), -1, HintBox,
   OffsetRect(HintBox, HintPos.X, HintPos.Y);
   Inc(HintBox.Right, 6);
   Inc(HintBox.Bottom, 2);

   { Now show the window: }
   Result.ActivateHint(HintBox, ShortHint);
 end; {RevealHint}

 procedure RemoveHint (var Hint: THintWindow);
{ Releases the window handle of a Hint previously popped up with }
{ RevealHint.                                                    }
   Hint := nil;
 end; {RemoveHint}

The line marked <<<< above is the one that positions the hint
window below the control.  This could obviously be altered if
you want a different position for some reason.

Regards, Zif.
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


Accepted Solution

ZifNab earned 200 total points
ID: 1338636

 you know when the mouse moves over the Listbox, you can calculate from there, which item the mouse is on. You can call from there (with the above code) which hint has to appear and you can remove the hint any time you want, or not remove it.

Regards, Zif.

Author Comment

ID: 1338637
Hi Zif
   Sorry it took so long for me to respond, I have been quite busy with work, we're just about to release a new version. You will be happy to know that a version of your code above made it into the next release. The only suggestion I have is to set the hint color before calling it - hint.color := application.hintcolor. (Off the top of my head). That way the hint appears homogenous with the rest of the application. (That being said, I don't know why it is not the same color as hints appearing in Windows... where is it getting that weird shade of yellow from, or is that just a function of my peculiar settings?)
  Thankyou for your help.



Expert Comment

ID: 1338638
Glad I could help. See you!

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

636 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