Change tooltips when Hovering over a grid cell.  
Author Message
Aleniko29139





PostPosted: Visual FoxPro General, Change tooltips when Hovering over a grid cell. Top

I am not sure if this is possible:

I need to implement something like the new memo field content preview (When you hover over a memo field of a grid, it will show its content in a tooltip style).

I need to show some additional info about a customer when the user is hovering over the account # in the grid. I have tried to manipulate the tooltip of the textbox, or the tooltip of the column at run time and it didn't work for me.

Is this possible I'd rather not use a click or doubleclick to open a form, but rather hover over a cell in a grid.

Thanks.


Visual FoxPro1  
 
 
CetinBasoz





PostPosted: Visual FoxPro General, Change tooltips when Hovering over a grid cell. Top

It's possible but tooltiptext has a limit. If you want a VFP6-7 days implementation which is not perfect then I'll post it.


 
 
Aleniko





PostPosted: Visual FoxPro General, Change tooltips when Hovering over a grid cell. Top

Cetin;

I'm looking for any kind of solution. If you are aware of a better solution using hover over the grid cell, I would gladly take it...
The amount of information I need to display is very small - 30-40 bytes long.

Thanks!

 
 
Aleniko





PostPosted: Visual FoxPro General, Change tooltips when Hovering over a grid cell. Top

Anyone has an idea how to do this
Thanks.

 
 
CetinBasoz





PostPosted: Visual FoxPro General, Change tooltips when Hovering over a grid cell. Top

Here is an old sample:

Public oForm
oForm = Createobject('myForm')
oForm.Show

Define Class myForm As Form
 DataSession = 2
 ShowTips = .T.
 Procedure Load
  Use employee
 Endproc
 Add Object myGrd As myGrid With RecordSource = 'Employee'
Enddefine

Define Class myGrid As Grid
 DeleteMark = .F.
 ReadOnly = .T.
 RecordMark = .F.
 ScrollBars = 3
 SplitBar = .F.
 Highlight = .F.
 HighlightRow = .F.
 Name = "grdMyGrid"

 Procedure AddColumn
  Lparameters nIndex, cAlias, cField
  Nodefault
  This.AddObject("clm"+cField,"myColumn", cAlias+"."+cField,nIndex)
 Endproc

 Procedure Init
  Lparameters tcRecordsource
  tcRecordSource = Iif(Empty(m.tcRecordSource),This.RecordSource,m.tcRecordSource)
  With This
   .ColumnCount = -1
   .RecordSource = tcRecordsource
   nOldColCount = .ColumnCount
   For ix = 1 To Fcount(tcRecordsource)
    .AddColumn(ix, tcRecordsource,Field(ix,tcRecordsource))
   Endfor
   .ColumnCount = nOldColCount
   .SetAll('Visible',.T.)
  Endwith
 Endproc

 Procedure When
  Set Cursor Off
 Endproc

 Procedure Valid
  Set Cursor On
 Endproc
Enddefine

Define Class myColumn As Column
 Resizable = .F.
 Movable = .F.
 Procedure Init
  Lparameters cControlSource, nIndex
  With This
   .ControlSource = cControlSource
   .ColumnOrder = nIndex
   .RemoveObject('Header1')
   .AddObject('myHeader','myHeader')
   .AddObject("myText","myGridTxtBox")
   .CurrentControl = "myText"
   .Sparse = .F.
  Endwith
 Endproc
 Procedure MouseMove
  Lparameters nButton, nShift, nXCoord, nYCoord
  With This.Parent
   lnActiveRow = Ceiling( ;
    ( nYCoord - (.Top + .HeaderHeight) ) / .RowHeight )
   lnActivecol = This.ColumnOrder - This.Parent.LeftColumn + 1
   .ActivateCell(lnActiveRow,lnActiveCol)
  Endwith
  This.myText.ToolTipText = ;
   iif(Type(This.ControlSource)='C', Eval(This.ControlSource),;
   iif(Type(This.ControlSource)='M', Mline(Eval(This.ControlSource),1),''))
 Endproc
Enddefine


Define Class myGridTxtBox As TextBox
 Procedure Init
  This.BorderStyle = 0
 Endproc
 Procedure Click
  This.SetFocus()
 Endproc
Enddefine

Define Class myHeader As Header
 Procedure Init
  This.Caption = Proper(Justext(This.Parent.ControlSource))
 Endproc
Enddefine

 
 
Aleniko





PostPosted: Visual FoxPro General, Change tooltips when Hovering over a grid cell. Top

Cetin;

So, you are using this to get the value of the cell under the mouse... Is there a better way to do this with VFP9.0, or should I stick to this older method Is there a way to read the data under the mouse without activating the cell

  With This.Parent
lnActiveRow = Ceiling( ;
( nYCoord - (.Top + .HeaderHeight) ) / .RowHeight )
lnActivecol = This.ColumnOrder - This.Parent.LeftColumn + 1
.ActivateCell(lnActiveRow,lnActiveCol)
Endwith


Thanks!



 
 
CetinBasoz





PostPosted: Visual FoxPro General, Change tooltips when Hovering over a grid cell. Top

No I'm not using it. There is another better way that doesn't require VFP9 (sorry proprieraty code).
 
 
Aleniko





PostPosted: Visual FoxPro General, Change tooltips when Hovering over a grid cell. Top

Cetin;

I'm not asking for the source code. I'm asking if there is a new command in VFP7-VFP9 that I can utilize in order to get the value of the grid cell that the mouse has entered. If you can give me some idea, it would be great. Keep in mind that I am trying to do so WITHOUT SELECTING THE CELL.

Thanks alot (In any case, you were helpful.)




 
 
CetinBasoz





PostPosted: Visual FoxPro General, Change tooltips when Hovering over a grid cell. Top

Try Gridhittest() and bindevent() (VFP9).