Re: Cell update signal in GtkSheet

From: Date: Mon, 11 Jul 2005 16:17:14 +0000
Subject: Re: Cell update signal in GtkSheet
References: 1 2  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-5962@lists.php.net to get a copy of this message
Hi Jake, You must connect the sheet's "traverse" signal: class test { function init() {
      ...
       // Connect the traverse signal, emmited on sheet 'traverse'
       $sheet->connect_after('traverse', array(&$this, 'sheet_traverse'));
} function sheet_traverse($sheet,$row_ant,$col_ant,$row_act,$col_act) {
      // Let's get the cell data and update db
      ....
} } Sure it helps. :) Regards, Gonzalo Jake Gordon escribió:
Generally, it would be great to see *any* code anyone's written that has gtksheets in it, as this would be documentation by example. Jake Jake Gordon wrote:
I'm using a GtkSheet which takes data from a database and enables the user to edit that data. The documentation for GtkSheet seems to be very poor: http://gtk.php.net/manual/en/extra.gtksheet.php ... notably, it says nothing of the sheet's signals. I can get data into the sheet fine from the database (e.g. $sheet->set_cell($row, $col, 1, $data); ). But how do I update the database when a cell is changed? If I need to connect a function to the cell itself rather than the sheet, how do i reference that cell? Or how is this done? I can run: $sheet->connect("changed","update_db"); ... but there are 3 problems with this. First, this connects the sheet not the cell in question, so if this is the way to do it i'd also need to send the row and column reference. Second, this event is also given when loading the sheet for the first time, which is not desired Third, this event is called between every key press within a cell. I only want it to be called when I've finished editing a cell and changed focus to another cell. --- Perhaps best is if someone can point me to some better documentation for this and similar issues on GtkSheet. I'm using: http://gtk.php.net/manual/en/extra.gtksheet.php ... at the moment. Thanks, Jake.


« previous php.gtk.general (#5962) next »