>Hi!
>
>This require a grid class. You can use no of class, but you will require a separate form method or PRG that will update the tool tip for grid from different elements. With Grid class an approach is following:
>
>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>In the MouseMOve event for each column:
>
>this.parent.ToolTipText = eval("this." + this.CurrentControl + ".ToolTipText")
>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>In the MouseMOve event for each header:
>
>this.parent.parent.ToolTipText = "Something"
>
>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>In the MouseMove event of the grid class:
>
>LPARAMETERS nButton, nShift, nXCoord, nYCoord
>if NOT (this.ToolTipText == this.OriginalToolTip)
> local nWhere_Out, nRelRow_Out, nRelCol_Out, nView_Out
> this.GridHitTest(m.nXCoord, m.nYCoord, ;
> @nWhere_Out)
>
> if NOT INLIST(m.nWhere_Out,13,14)
> this.ToolTipText = this.OriginalToolTip
> endif
>endif
>
>
>In the Init of the Grid class:
>
>this.OriginalToolTip = this.ToolTipText
>
>
>Then define the Assign method for ToolTipText property of the grid with following code:
>
>LPARAMETERS lcNewToolTip
>
>if NOT (this.ToolTipText == left(m.lcNewToolTip,254))
> local lcStr, lnX, lnY
>
> declare integer GetCursorPos in Win32API as _GetCursorPos string @lcStr
> declare integer SetCursorPos in Win32API as _SetCursorPos integer x, integer y
>
> lcStr = replicate(chr(0), 8)
> = _GetCursorPos(@lcStr)
>
> lnX = ((( asc(substr(m.lcStr, 4, 1)) * 256) + asc(substr(m.lcStr, 3, 1))) * 256 + asc(substr(m.lcStr, 2, 1))) * 256 + asc(left(m.lcStr, 1))
> lnY = ((( asc(substr(m.lcStr, 8, 1)) * 256) + asc(substr(m.lcStr, 7, 1))) * 256 + asc(substr(m.lcStr, 6, 1))) * 256 + asc(substr(m.lcStr, 5, 1))
>
> = _SetCursorPos(0, 0)
> DOEVENTS
> this.ToolTipText = left(m.lcNewToolTip,254)
> = _SetCursorPos(m.lnX, m.lnY)
>
>endif
>
>
>
>As you see, I found a way to force VFP to hide previous tool tip and display new tool tip when mouse is moving from one element of grid to another. Looks not bad. I suspect there could be a better way (send some Windows message to form or so), I did not experimented more once I found one solution that is good enough.
>
>I will put the content of this message to the FAQ.
>
>
>
>>Hi everyone,
>>
>>I'm wondering, if somebody implemented ToolTipText (StatusBarText) for Header control? It should not be too complicated, but I need some ideas. If you have class written and you're willing to share, it's even better.
>>
>>Thanks a lot in advance.
Vlad,
Do you have VFP7.0 already? I still don't, so I can not test MouseEnter/MouseLeave events for Header. They may do the same trick, but it would be simpler.
Anyway, I'll probably create a subclass of our main grid class with this functionality included. Thanks a million.
If it's not broken, fix it until it is.
My Blog