I am encountering a strange problem with Gtk2::TreeView. The story is as follows. In my treeview, I want to make some cells 'hyper-linkable'. That is, when I click on certain cells, I want a call-back sub to be called. I achieve this by trapping the 'button-press-event' and calling the specified sub on that event. That portion works fine. But in addition, I also want to provide the user a visual feedback that this particular cell is "clickable". The approach I thought of is to change the mouse-pointer to 'hand2'... Kinda like the web browser on a link. And this is where the problem occurs. The way I achieve this is by trapping the 'motion-notify-event' of the treeview and then calling the treeview->get_path_at_pos to identify the cell (always a CellRendererText for me) on which the mouse is. Then I look at the contents of the CellRendererText and then change the mouse pointer accordingly. The event is getting trapped correctly. But when I try to look at the contents of the $cell, I always don't get the correct value. Sometimes, it seems to be retrieving the value of the previous cell that I visited.. sometimes it works fine. The problem is detected randomly. I have replicated the problem in a small piece of code and attaching it. Move your mouse on the numbers '0.2 and '0.9' on the tree a few times randomly and you'll see what the issue is. ofey.
Attachment:
tree.pl
Description: Binary data