re: Select box Equiv

From: Date: Mon, 07 Apr 2003 15:40:16 +0000
Subject: re: Select box Equiv
Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-3221@lists.php.net to get a copy of this message
Reposting this item, since we didn't see any responses first time around. Madeleine D. --------------------------------- Still no luck on using the combo box to select and populate data. >Yes, the combo is the equivalent. >You have tho connect the "changed" (or similar, don't have a manual here) >signal to your function to change the other widgets. > I set up the function against the 'select_child' signal to read our MySQL data with 'set_text' to populate the fields. But, if we put the function in the same file as the Combobox, it says it can't find the function ('Unable to call signal callback'). If we put it in another 'main functions' file, it can't find the fields. We get a 'Call to member function on a non-object' at the first field reference. Sorry, but I can't see what's happening here. thanks in advance. Madeleine D.

<?php Class ComboBox extends GtkCombo { function ComboBox ($query,$txt,$lablew,$lableh,$fieldw,$fieldh,$function) { $this->GtkHBox(False,2); $label=&new GtkLabel($txt); $label->set_justify(GTK_JUSTIFY_LEFT); $label->set_usize($lablew,$lableh); $this->pack_start($label, false, false, 5); $dropper=&new GtkCombo(); $dropper->set_usize($fieldw,$fieldh); $result=mysql_query($query); while($data=mysql_fetch_row($result)) { $list[]=$data[0]; } array_unshift($list,'(New)'); $dropper->set_popdown_strings($list); $this->add($label); $this->add($dropper); if($function){ $list=$dropper->list; // $listitem=$dropper->listitem; $list->connect('select_child', 'set_ins_data'); } } // End of Function ComboBox function set_ins_data ($list) { $data = mysql_query("Select * from INS"); $numrows = mysql_numrows($data); if(!$numrows) $numrows = 0; $i = 0; while($i<$numrows){ $entryINSNO->set_text(mysql_result($data, 0, "INSNO")); $entryNAME->set_text(mysql_result($data, 0, "NAME")); $entrySTREET->set_text(mysql_result($data, 0, "STREET")); $entryCITY->set_text(mysql_result($data, 0, "CITY")); $entrySTATE->set_text(mysql_result($data, 0, "STATE")); $entryZIP->set_text(mysql_result($data, 0, "ZIP")); $entryPHONE->set_text(mysql_result($data, 0, "PHONE")); $i++; } //End while list } //End function set_ins_data } // End of Class ?>
« previous php.gtk.general (#3221) next »