views:

269

answers:

3

Sure I've seen this done before but off-hand I can't find any examples.

I've got a TListView, set in 'report' viewstyle. It has about half a dozen subitems, and one thing we'd like to do is have the 'hint' (tooltip) on the listview dynamically show another field of data. That is, each time you move the mouse over any given row, the 'hint' would show some text relevant to that particular row.

I'm partway there - I can do this using the OnInfoTip method, but unfortunately once a tip has appeared, Windows seems to decide that I don't need to see a hint for the listview again until I move the mouse away from the listview and then back 'over' it again. Simply moving the mouse down to the next row, all-the-time keeping the mouse over the control, doesn't persuade the program to display the new hint.

Just to be clear - I've got OnInfoTip working so that the program does display the right hint relevant to the item I first moved the mouse over. Changing the hint text isn't the issue. The problem is that moving the mouse to another item in the listview doesn't cause the software to show a new hint. (Hope that makes sense).

Is there some proper way of getting this behaviour to work, or am I going to end up doing something icky with mouseovers and then manually drawing a hintbox (etc)?

A: 

Offtopic: This is simple in Virtual Treeview component, it is build-in feature.

DiGi
Thanks. I know (and quite like) Virtual Treeview but in this particular case it's a long-standing, entrenched bit of legacy code. In some respects it would be nice to move it to a DevExpress grid (or similar).
robsoft
+4  A: 

check the following link:

Display Custom Hints for TListView Sub Items

Edit:

I just checked it now on delphi7 it's showing the hint for every row dynamically after moving the mouse on the listview.

Wael Dalloul
Many thanks Wael, - I just looked at the code myself. I don't need it to change the hint on a per-subitem basis, but the code that was there gave me a pointer to 'Application.ActivateHint' which was exactly what I needed. I'll keep the question open for now in case a more elegant way turns up, but for now mouseover, oninfotip and application.activatehint seem to do the trick. :-)
robsoft
A: 

i was using the OnInfoTip event (i didn't need hints for the subitems). the hint was "flashing" (show/hide/show/hide/show/hide/show/hide). found the listview's ShowHint was false. set it to True and it worked as it should.

X-Ray