开发者

Virtual TreeView update hint within cell on mouse move

I'm using a TVirtualStringTree as a grid which is working pretty well.

I'm using the treeviews hint functionality to show a hint when the user positions the mouse over a cell. I've had to change HintMode to hmHint as I want my hints to appear regardless of the cell text length.

What I'm trying to do now is to display a different hint depending on whereabouts the mouse is within the cell.

I can do this no problem before the hint is displayed by using the OnGetHint event. My problem is this event 开发者_运维技巧is only raised a next time when the user moves the mouse to another cell.

I can't see to find a way to update the hint while its displayed and the mouse is moved within the same cell

I've looked at suggestions for other controls, using the Application's OnShowHint event but they just seem to make the hint disappear and not show again.

Anyone got any ideas?

Thanks

Update

After some investigation here is what I have found in case it helps someone come up with a solution:

The CMHintShow method sets the CursoRect field of the HintInfo record to the bounds of the cell. This seems to stop the VCl from triggering the hint code again until the mouse moves out of this rect (TApplication.HintMouseMessage).

If i set the CursorRect to something smaller than the cell bounds the hint will update. I use VTs in a few places for different purposes, so I can't make these changes directly. Would be good to get a solution that doesn't require this change.


In TBaseVirtualTree.CMHintShow right near the top, the code reads:

if PtInRect(FLastHintRect, HintInfo.CursorPos) then
  Exit;

If you comment this out then the behaviour is closer to what you are looking for. The hint window won't show again if you move the mouse within the same cell, but if you click then it will.

I can't seem to find any way to make the hint window show in the same cell without that mouse click though!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜