Retrieve GtkCList Selection Info?
| From: | Landon Chelf | Date: | Wed, 03 Dec 2003 15:41:50 +0000 |
| Subject: | Retrieve GtkCList Selection Info? | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-4272@lists.php.net to get a copy of this message | ||
Hello,
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();