clist selsction

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: clist selsction
Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-5058@lists.php.net to get a copy of this message
Hello, stupid question I'm sure...I'm not new to php but am new to phpgtk and desktop apps in general, so I'm sure I'm having brain block going from a static web environment. My question is in regards to getting the selection from a clist, is it my understanding that process wise to get a selection from clist you need to create a function and send the clist array ($list for example) to a function to obtain the selected key because it is not available in the main function where the list was created? In otherwords you can't get the selection from the same function where the clist was created? $box = &new GtkVBox(); $scrolled_win = &new GtkScrolledWindow(); $scrolled_win->set_policy( GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); $scrolled_win->set_usize(280, 100); $list = &new GtkCList( 2, array( "regionId", "regionName")); $q=mysql_query("select regionId,regionName from regions"); while($row = mysql_fetch_array($q,MYSQL_ASSOC)){ $list->insert( 0, $row); } $scrolled_win->add( $list); $box->add( $scrolled_win); $button=&new GtkButton("Delete region"); $button->connect_object("clicked", "confirmDeleteRegion",$list); $box->add($button); $window->add($box); $window->show_all(); function confirmDeleteRegion($list) { $row = $list->selection[0]; $regionId = $list->get_text($row, 0); /* confirm & delete */ } so you can't pass the regionId from button to confirmDeleteRegion like: $button->connect_object("clicked", "confirmDeleteRegion",/* something here to pass selected regionId*/); function confirmDeleteRegion($regionIdToDelete){ /* delete the region sent */ } and instead have to send confirmDeleteRegion the $list, get the selection, then delete? whereas in a web app you would get it from a form input $_GET or $_POST $ok = confirmDeleteRegion($_GET[regionId]) confirmDeleteRegion($regionIdToDelete) { /* delete */ } Thanks for any assistance I'm confused =), shannon

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