Tooltip on a grid cell

In my application I'd like to show a tooltip for certain grid cells
when the mouse is positioned over the cell. I googled for information
and found only the following tips back in 2001:

EVT_MOTION(self.GetGridWindow(), self.OnMouseMotion)

def OnMouseMotion(self, evt):
   x, y = evt.GetPosition()
   row = self.YToRow(y)
   col = self.XToCol(x)
   self.GetGridWindow().SetToolTipString(
   "Here is the ToolTip for (%d, %d)" % (row, col))
   evt.Skip()

The above code works. However the tooltip shown is not at the location
near the mouse position, but is shown below the whole grid. Given that
GetGridWindow returns the Window associated with the whole grid, this
is not surprising, but is not what I wanted.

Is there any means to show the tooltip beneath the grid cell the mouse
pointer is over? For example, it is possible to get the window
associated with the grid cell in question and then associate a tooltip
with that cell window?

···

--
Hong Yuan

大管家网上建材超市
装修装潢建材一站式购物
http://www.homemaster.cn

Is there any means to show the tooltip beneath the grid cell the mouse
pointer is over? For example, it is possible to get the window
associated with the grid cell in question and then associate a tooltip
with that cell window?

Not a regular tooltip, but you can create your own tooltip handling.
Basically, you need to catch EVT_MOTION, EVT_ENTER_WINDOW and EVT_LEAVE_WINDOW.
Then, if the user does not move the mouse for a while, you can put a parentless wx.Frame instance onto the top, showing your hint. You can use wx.GetMousePosition() to get the current mouse position and align the tooltip frame to that.

You can download an example here:

http://messlib.dyndns.org/

after download, start the "XMLGridCellRenderer" demo, that will show you an example. The custom tooltip window is in wxMegaWidgets/XMLHint.py

Best,

   Les

Thanks for the tip. I tried to download the messlib package, but the
download link doesn't seem to be correct and I got a 404 Not Found
error. The link looks strang anyway:

http://messlib.dyndns.org/templates/default.eng//templates/default.eng/download/releases/messlib-0.0.1.tgz

Is it the correct one?

···

On 10/3/05, László Nagy <nagylzs@freemail.hu> wrote:

You can download an example here:

http://messlib.dyndns.org/

after download, start the "XMLGridCellRenderer" demo, that will show you
an example. The custom tooltip window is in wxMegaWidgets/XMLHint.py

--
Hong Yuan

大管家网上建材超市
装修装潢建材一站式购物
http://www.homemaster.cn

Thanks for the tip. I tried to download the messlib package, but the
download link doesn't seem to be correct and I got a 404 Not Found
error. The link looks strang anyway:

http://messlib.dyndns.org/templates/default.eng//templates/default.eng/download/releases/messlib-0.0.1.tgz

Is it the correct one?

It was a broken link. Sorry. :frowning: Here is the correct one:

http://messlib.dyndns.org/download/releases/mess-0.0.1.tgz

   Les