Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

text tool tips

Status
Not open for further replies.

budman48

MIS
Dec 20, 2002
23
0
0
US
Is there a way to use a Memo variable from a file to display what is in the Memo variable on a grid. So for instance when I put my mouse cursor over the record I want. The message that I have in the Memo variable will pop up.
 
In VFP9 it's a default behavior if you leave the textbox control with memo.
 
From your statement
"Memo Variable from a file" "Memo Variable on a grid"

Question?
1. Are these the exact same Memo Var File & Grid?
or
2. Memo Var File and Memo Var Grid, are different from different sources?
or
3. Memo Var File and Memo Var Grid are different from same source?


David W. Grewe Dave
 
Let me clarify a little bit.
My file has vendor, req #, amount, inv #, description, and a couple of other fields.

My grid has a couple of thos fields but not the description field that is a memo field. I want to be able to select a row in my grid and using tooltexttip I want my description field to show what is in it.


Thanks
 
but not the description field that is a memo field...

If I understand this. The memo field is NOT in the Grid and you want the tool tip to show whats in the memo field when you hover your mouse on a record in a row... Right?

If so in the column1 Mouse Enter put the following:
this.tooltiptext = <<tablename>>.description

***column1.Mouseleave()
this.tooltiptext = ""

But you have to select the record i.e. click the row in Column 1 When you hover in the unselected row it will display the description for the selected row and not the one your mouse is over.
 
Do not know if this will work, but try

in the grid, Methods Tab, GotFocus()
this.tooltexttip = TABLE.MEMOField

Make sure Column, Data tab, bound=.t.


David W. Grewe Dave
 
Sorry forgot to mention; forms showtips property has to be set to .T.
 
Sorry to put a damper on this, but I don't think any of the ideas discussed here will work.

The problem is that VFP has no way of knowing which row the mouse pointer is currently hovering over. The rows in the grid are not separate objects. As far as VFP is concerned, the mouse can hover over the grid as a whole, or a column, but not a row.

The only way I can think to get round that would be to use MROW() and MCOL() to determine the mouse's position within the screen, and then to factor in the location of the form within the screen, and the grid within the form, then somehow use the grid's GridHitTest to figure out which row you are on. Not something I would want to do on an empty stomach.

Unless someone can come up with a better idea, I would suggest looking for some other interface to achieve the goal.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Just thought I'd throw my two cents worth in here. If you're willing to change what action displays the memo field, the following might work for you. I did something similar to this, but I used a Right-Click and hold to display a memo field (Mouse Up and Down Events). As long as the user held the Right mouse button down over a row, the memo would display in an edit box centered over the grid. I put an edit box inside of a shape with a red background color to make it stand out and made them invisible. Set the data source of the edit box to the memo field of the gridsource table. On the mouse down event I just centered, made them visible, etc. This worked fine as most of the memos I was displaying were fairly small. You could probably adjust size of editbox based on the memo's contents. Anyway, just another idea!

Auguy
Sylvania, Ohio
 
Hello Mike, was wondering where you were, working hard and diligently,I hope{g}. The mouse Enter works but is a PIA. The problem is the row has to be selected otherwise the tooltiptext displays the description for the one selected irrespective of where the mouse is. Here is how:
Bindevent() is a great candidate for this as well.
Code:
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
	**************************************************
*-- Form:         form1 (c:\imaginecorp\form11.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   04/28/07 12:19:06 PM
*
DEFINE CLASS form1 AS form
	DoCreate = .T.
	ShowTips = .T.
	Caption = "Form1"
	Name = "Form1"

	ADD OBJECT grid1 AS grid WITH ;
		ColumnCount = 2, ;
		DeleteMark = .F., ;
		Height = 182, ;
		Left = 18, ;
		Panel = 1, ;
		RecordSource = "categories", ;
		ScrollBars = 2, ;
		Top = 24, ;
		Width = 325, ;
		Name = "Grid1", ;
		Column1.ControlSource = "Categories.categoryid", ;
		Column1.Width = 148, ;
		Column1.Name = "Column1", ;
		Column2.ControlSource = "Categories.categoryname", ;
		Column2.Width = 142, ;
		Column2.Name = "Column2"


	ADD OBJECT form1.grid1.column1.header1 AS header WITH ;
		Caption = "Header1", ;
		Name = "Header1"


	ADD OBJECT form1.grid1.column1.text1 AS textbox WITH ;
		BorderStyle = 0, ;
		Margin = 0, ;
		ForeColor = RGB(0,0,0), ;
		BackColor = RGB(255,255,255), ;
		Name = "Text1"


	ADD OBJECT form1.grid1.column2.header1 AS header WITH ;
		Caption = "Header1", ;
		Name = "Header1"


	ADD OBJECT form1.grid1.column2.text1 AS textbox WITH ;
		BorderStyle = 0, ;
		Margin = 0, ;
		ForeColor = RGB(0,0,0), ;
		BackColor = RGB(255,255,255), ;
		Name = "Text1"


	PROCEDURE Load
		If Select("categories") > 0
			Select categories
		Else
			Select 0
			Use Home()+"\samples\northwind\categories.dbf" Shared
		Endif
	ENDPROC


	PROCEDURE grid1.Init
		SELECT Categories
		this.refresh
		GO top
	ENDPROC


	PROCEDURE grid1.Column1.MouseLeave
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		this.ToolTipText = ""
	ENDPROC


	PROCEDURE grid1.Column1.MouseEnter
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		this.ToolTipText = categories.description
	ENDPROC


	PROCEDURE grid1.Column2.MouseLeave
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		this.ToolTipText = ""
	ENDPROC


	PROCEDURE grid1.Column2.MouseEnter
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		this.ToolTipText = categories.description
	ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
 
MikeLewis
Sorry to put a damper on this, but I don't think any of the ideas discussed here will work.

So, did you check each of the links I posted here and tried it before dismissing the idea?
 
Ilyad,

So, did you check each of the links I posted here and tried it before dismissing the idea?

No.

In fact, I did suggest a possible approach (using MROW(), MCOL() and GridHitTest). Imaginecorp's solution takes a similar approach, except that his is much simpler than I envisaged (and no doubt better coded than I could have done).

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
see my post on how to do this...

I think I saw a separate post yesterday, but it was too late to try. I do not see this separate post now.
 
Thank you Mike…
The post got removed and I could not login… Maybe Dave is trying to tell me something {g}
The code is now in Forms & classes..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top