PHP-GTK2 Cookbook Forum
Welcome, Guest
Please Login or Register.    Lost Password?
gtktreeview/cell renderer - which cell got clicked (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: gtktreeview/cell renderer - which cell got clicked
#869
sutterp (User)
Fresh Boarder
Posts: 19
graphgraph
User Offline Click here to see the profile of this user
gtktreeview/cell renderer - which cell got clicked 1 Month, 3 Weeks ago Karma: 0  
In a GtkTreeView I use append_column to add the columns and use GtkTreeStore as model, as shown in your examples.

The first column in the TreeView contains the registration number of a vehicle, the following columns contain the ID of drivers/customers that have booked the vehicle. There could be 1 to n drivers. Clicking on the cell of the driver, should reveal the details of the driver.

The following maps the changed event to my processing function.
$selection = TreeView->get_selection();
$selection->connect('changed',array($this, 'cbkCellSelect'));

In cbkCellSelect list($this->model, $iter) = $selection->get_selected();

$iter gives me access to all the row's data, but I don't not know which cell got clicked.

What methods/signals/means are available to find out which cell got clicked?

Peter
 
  The administrator has disabled public write access.
#871
kksou (Admin)
Admin
Posts: 391
graph
User Online Now Click here to see the profile of this user
Re:gtktreeview/cell renderer - which cell got clicked 1 Month, 3 Weeks ago Karma: 8  
Hi Peter,

Please refer to the following sample code:

How to display context-sensitive popup menu with right mouse click in GtkTreeview?

Basically you make use of the signal "button-press-event" to get the mouse-click position, and then use the method GtkTreeView::get_path_at_pos() to transform the mouse position into row and column position.

The example uses right mouse button. You can easily adapt the code to use it for left mouse or middle mouse clicks.

Regards,
/kksou
 
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop

Blog - Forum - Privacy Policy - Contact Us
Copyright © 2006-2008. kksou.com. All Rights Reserved