Tooltips - grid cell

Started by Marc van Cauwenberghe, November 25, 2012, 05:14:03 AM

Previous topic - Next topic

Marc van Cauwenberghe

Hi,
I am trying to show the content of a cell grid when I am hovering over it. I am using an Egrid.
Init:

   gTooltipHwnd = Tooltip_Add (HWND_FRMBEHEERRUWEIMPORTBETALINGEN_EGRUWEIMPORTBETALINGEN,Space$(254),%TRUE)
   Tooltip_SetTitle (gTooltipHwnd, %TTI_INFO, "Beschrijving:")

Hovering:

Function FRMBEHEERRUWEIMPORTBETALINGEN_EGRUWEIMPORTBETALINGEN_EGN_MOUSEHOVERINEGRID (ControlIndex As Dword, HwndForm As Dword, hEGrid As Long, wParam As Dword, lParam As Long) As Long
   Local EGN As EgridNotify Ptr : EGN = Lparam
   Static sText As String
   If @EGN.CELL.X  = 5 Then   
      'If sText <> CellGetText( hEGrid, @EGN.CELL.X , @EGN.CELL.Y  ) Then
         sText = CellGetText( hEGrid, @EGN.CELL.X , @EGN.CELL.Y  )
         Tooltip_SetText (gTooltipHwnd, HWND_FRMBEHEERRUWEIMPORTBETALINGEN_EGRUWEIMPORTBETALINGEN, sText)
      'End If   
   End If   
End Function


With this code the flickering is very bad and I don't get the click event any more.
When checking the text and only doing a 'Tooltip_SetText' when the text differs I get the tooltip but only for a short while. I can't even read the tooltip.

Any suggestion?

Thanks for any answer.

Marc

Paul Squires

Hi Marc, I don't use egrid so I am not a good one to comment on this topic. Have you tried testing to see that gTooltipHwnd is a valid handle and only set the text if the text has changed?

If IsWindow(gTooltipHwnd) Then
  If sText <> TooltipText Then
Tooltip_SetText (gTooltipHwnd, HWND_FRMBEHEERRUWEIMPORTBETALINGEN_EGRUWEIMPORTBETALINGEN, sText)

etc...
Paul Squires
PlanetSquires Software