Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ToolTipText and StatusBarText for Header
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00598347
Message ID:
00614031
Vues:
26
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 Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform