AlanScottAgain 1 Posted October 31, 2022 Hi I have a gauge that draw I on a Skia paintbox. I can move the gauge with the mouse. 0-100 SkPaintBox1.Hint:= IntToStr(Position); SkPaintBox1.ShowHint:= True; Shows the hint but not as the mouse moves. How can I show a hint to display the current value as the mouse moves to update the gauge? Do I need to create my own hint window? Thanks Alan Share this post Link to post
PeterBelow 238 Posted October 31, 2022 9 hours ago, AlanScottAgain said: Hi I have a gauge that draw I on a Skia paintbox. I can move the gauge with the mouse. 0-100 SkPaintBox1.Hint:= IntToStr(Position); SkPaintBox1.ShowHint:= True; Shows the hint but not as the mouse moves. How can I show a hint to display the current value as the mouse moves to update the gauge? Do I need to create my own hint window? Thanks Alan The hint system is designed to show a hint for a certain time when the mouse enters a control's real estate. In your case the mouse stays over the paintbox, so the hint is not shown again even if its value changed. Try to call Application.CancelHint after changing the value. And if you draw the gauge anyway, why not draw the value as well instead of using a hint window? Share this post Link to post
Remy Lebeau 1394 Posted October 31, 2022 (edited) 10 hours ago, AlanScottAgain said: How can I show a hint to display the current value as the mouse moves to update the gauge? You can either subclass the Gauge control to handle the CM_HINTSHOW message, or you can use the TApplication.OnShowHint/TApplicationEvents.OnShowHint event, to get access to a (pointer to a) THintInfo record, which has HintControl, HintStr, CursorPos, and CursorRect members (amongst other things). As the mouse moves around your UI, the THintInfo members will update accordingly. When the mouse moves from one control to another, the active hint gets reset. When the mouse stays inside of a given control and the CursorPos moves outside of the CursorRect, the active hint gets updated. This allows a control to sub-divide itself so it can have separate hints for different areas. So, if you want the hint to be updated with new text on every mouse move while the mouse is inside of the Gauge control, then whenever the THintInfo's HintControl is pointing at the Gauge control, you can simply set the THintInfo's CursorRect to a 1x1 pixel square at the current CursorPos coordinates, and set the HintStr to the desired text. This way, the next mouse move will go outside of the CursorRect and update the active hint with the new HintStr text. Quote Do I need to create my own hint window? No, you do not. Edited October 31, 2022 by Remy Lebeau Share this post Link to post
AlanScottAgain 1 Posted November 2, 2022 Thank you I will try the TApplication.. method Share this post Link to post