Re: Retrieve GtkCList Selection Info?
| From: | Alan Knowles | Date: | Thu, 04 Dec 2003 01:22:54 +0000 |
| Subject: | Re: Retrieve GtkCList Selection Info? | ||
| References: | 1 2 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-4274@lists.php.net to get a copy of this message | ||
print_r($clist->selection);
???
Regards
Alan
Yann Larrivee wrote:
Hi, Here is what works for me. $clist->connect('select-row','select_row'); Here you will find all the signals that a clist return http://developer.gnome.org/doc/API/gtk/gtkclist.html#GTKCLIST-SELECT-ROW function select_row($list,$row,$col,$event) { global $clist; if ($event->type == GDK_2BUTTON_PRESS) { echo $row.' '.$col; } } Here you will find the GDKEvent that will enable you to take what everaction you want single, double, tripple click ... http://gtk.php.net/manual/en/gdk.gdkevent.php Yann Larrivée www.phpquebec.org www.protonicdesign.com On Wed, 2003-12-03 at 10:41, Landon Chelf wrote:-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.comHello, I've been working with a GtkCList and have been trying to retrieve a single selection in the list but I can't seem to get it to work. Basically the following code should allow me to get the values of the selection each time it's selected. Any help at all would be greately appreciated. Just to note I'm testing with a full clist so there isn't an issue of no data to pass. function on_clist_button_press(){$selected=$clist->selection[0]; if(is_int($selected)) { echo get_text($selected, 0); }else{ echo gettype($selected); }}if(mysql_numrows($result)>0){ for($i=0;$i<$numrows=mysql_num_rows($result);++$i){ $row[$i]=mysql_fetch_row($result); } global $clist; $clist = &new GtkCList(4,array("SSN","LName","FName","MI")); $clist->set_uposition(2,2); $clist->connect_object("button-press-event", "on_clist_button_press", $clist); foreach ($row as $app){ $clist->append($app); } $clist->set_column_min_width(0, 100); $clist->set_column_min_width(1, 100); $clist->set_column_min_width(2, 100); $clist->set_column_max_width(3, 5); $clist->columns_autosize(); $scroll->add($clist); $window->add($scroll); }else{ $empty= &new GtkLabel("No Results Found!"); $window->add($empty); } $window->show_all();