Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Tooltips in grid
Message
From
04/02/2002 06:35:59
 
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00497761
Message ID:
00614688
Views:
14
>Hi!
>
>If you're interested, take a look to the new approach described in the Thread #598347 Message #614031
>

Vlad,

Thanks for the response
I ended up showing a label called from the mousemove event of the header
Only problem with it is that if I bring up the tooltip then click on the scrollbar to scroll it sideways then the tooltip gets confused.. some of it moves with the grid and some doesn't.

If you're interested here's the code I wrote
In the mousemove of the header
LPARAMETERS nButton, nShift, nXCoord, nYCoord

=This.Parent.Parent.ShowToolTip(nButton, nShift, nXCoord, nYCoord, This.Parent.Text1.ToolTipText)
Then in the grid
**************************************************************************************
*- Name............: Grdimspgrid.Showtooltip
*- Author..........: Will Jones
*- Parameters......: None
*- Return Value....:
*- Description.....:
*- Date............: 20/04/01
*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*- Modifications
*- Date		Made by		Description
*- ----------	----------	------------------------------------------------
*- 20/04/01     W Jones         Initial Programming
**************************************************************************************
lParameters nbutton, nshift, nxcoord, nycoord, tctooltip

* Any buttons pressed? if so then do nothing
If nbutton # 0
	Return
Endif

* Does the label Exist on the form? if not then Add it
If Not pemstatus(Thisform, "oToolTip",5)
	Thisform.AddObject('oToolTip',"lblToolTip")
Endif

With thisform
	* Only refresh the tooltip if it has a different caption
	* this stops the tooltip following the mouse around the grid header

	If .otooltip.Caption = Alltrim(tctooltip)
		** Has user been over this control for >0.5 seconds? if so then show it
		If .otooltip.waittimer + 0.5 < seconds()
			.otooltip.Visible = !Empty(tctooltip)
		Else
			If nxCoord + .otooltip.width  > Thisform.width && Thisform.Left+
				.otooltip.left = thisform.Width-.otooltip.width && thisform.left+
			Else
				.otooltip.Left = nxcoord
			Endif

			.otooltip.Top = MAX(nycoord - .otooltip.Height+35,0) && Shift the label down a bit so it doesn't cover the header
		Endif
	Else
		.otooltip.Visible = .F.
		.otooltip.AutoSize = .T.

		.otooltip.Caption = Alltrim(tctooltip)

		If .oTooltip.Left > Thisform.Width
			** Form has been Resized
			If nxCoord + .otooltip.width  > Thisform.width && Thisform.Left+
				.otooltip.left = thisform.Width-.otooltip.width && thisform.left+
			Else
				.otooltip.Left = nxcoord
			Endif
		Endif						

		* does it need WordWrap?
		If .otooltip.Left + .otooltip.width => Thisform.Width
			.otooltip.wordWrap = .T.
			.otooltip.left = Thisform.Width -.otooltip.width
		Else
			.otooltip.wordWrap = .F.
		Endif

		* Turn autosize on after deciding if wordWrap is needed - this will set the vertical height
		.otooltip.AutoSize = .T.

		.otooltip.waittimer = Seconds()
	Endif
	.otooltip.Tag = Transform(Seconds())

	If .otooltip.Left + .otooltip.width => Thisform.Width
		.otooltip.left = Thisform.Width -.otooltip.width
	Endif
Endwith
Will Jones
Previous
Reply
Map
View

Click here to load this message in the networking platform