GtkCombo
| From: | Rhys Campbell | Date: | Mon, 07 Jun 2004 13:55:56 +0000 |
| Subject: | GtkCombo | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-4628@lists.php.net to get a copy of this message | ||
Having a little problem with a combo box. I can't seem to get the selected value. I've
used this before but can't see why it's not working now. I used glade to produce my
interface and all the other widget work fine. I get no errors when I run the script. Is it something
to do with the xml file?? Code below, the get_device_name function is where the problem lies
<?php
////////////////////////////////////////////////
// Connect to the widgets in the .xml file. //
////////////////////////////////////////////////
$gx = &new GladeXML('C:/Glade/job_booking.glade');
$gx->signal_autoconnect();
require("commonfunctions.inc"); // for common functions
require("odbc.inc"); // for db connectivity
require('config.inc'); // include file for nx directory config
$window = $gx->get_widget("job_booking"); // get widget from xml file
$window->connect('delete-event', 'delete_event');
$window->connect('destroy', 'destroy'); // connect event with function
/////////////////////////////////////////////////
// Get Widgets from xml file and make them //
// available here. //
/////////////////////////////////////////////////
require("docket_details.inc");
require("address_details1.inc");
require("address_details2.inc");
// get combo box and button from xml file
$allocate = $gx->get_widget("allocate");
$combo = $gx->get_widget("combo");
// select usernames from the db to populate the combo list with
$result = odbc_exec($odbc, "SELECT logged_in FROM users")
or die (odbc_errormsg());
while($row = odbc_fetch_array($result))
{ // build an array with logged in users
$array_of_logged_in_users[] = ($row['logged_in']);
}
// populate the combo list with the array members
$combo->Set_Popdown_Strings($array_of_logged_in_users);
//////////////////////////////////////////////////
// Get the docket details entered into form //
//////////////////////////////////////////////////
function get_docket_details()
{
$docket_details = $GLOBALS['docket']->get_text().'|'.
$GLOBALS['company']->get_text().'|'.
$GLOBALS['fromto']->get_text().'|'.
$GLOBALS['customer']->get_text().'|'.
$GLOBALS['telephone']->get_text().'|'.
$GLOBALS['contact']->get_text().'|'.
$GLOBALS['notes']->get_chars(0, -1).'|'.
$GLOBALS['reference1']->get_text().'|'.
$GLOBALS['reference2']->get_text().'|'.
$GLOBALS['reference3']->get_text().'|'.
$GLOBALS['reference4']->get_text().'|'.
$GLOBALS['tariff']->get_text().'|'.
$GLOBALS['waitandreturn']->get_text().'|'.
$GLOBALS['prebooking']->get_text();
echo $docket_details;
}
function get_address_details1()
{
$address_details1 = $GLOBALS['number1']->get_text().'|'.
$GLOBALS['type1']->get_text().'|'.
$GLOBALS['company1']->get_text().'|'.
$GLOBALS['building1']->get_text().'|'.
$GLOBALS['street1']->get_text().'|'.
$GLOBALS['locality1']->get_text().'|'.
$GLOBALS['town1']->get_text().'|'.
$GLOBALS['county1']->get_text().'|'.
$GLOBALS['postcode1']->get_text().'|'.
$GLOBALS['contact1']->get_text().'|'.
$GLOBALS['telephone1']->get_text().'|'.
$GLOBALS['readyat1']->get_text().'|'.
$GLOBALS['deadline1']->get_text().'|'.
$GLOBALS['notes1']->get_chars(0, -1).'|'.
$GLOBALS['drops1']->get_text().'|'.
$GLOBALS['signature1']->get_text();
echo $address_details1;
}
function get_address_details2()
{
$address_details2 = $GLOBALS['number2']->get_text().'|'.
$GLOBALS['type2']->get_text().'|'.
$GLOBALS['company2']->get_text().'|'.
$GLOBALS['building2']->get_text().'|'.
$GLOBALS['street2']->get_text().'|'.
$GLOBALS['locality2']->get_text().'|'.
$GLOBALS['town2']->get_text().'|'.
$GLOBALS['county2']->get_text().'|'.
$GLOBALS['postcode2']->get_text().'|'.
$GLOBALS['contact2']->get_text().'|'.
$GLOBALS['telephone2']->get_text().'|'.
$GLOBALS['readyat2']->get_text().'|'.
$GLOBALS['deadline2']->get_text().'|'.
$GLOBALS['notes2']->get_chars(0, -1).'|'.
$GLOBALS['drops2']->get_text().'|'.
$GLOBALS['signature2']->get_text();
echo $address_details2;
}
function get_device_name()
{
$comboEntry = $GLOBALS['combo']->entry; // access the selected list item
$device_name = $comboEntry->get_text(); // set device_name to selection
}
function send_job()
{
$filename = $GLOBALS['nx_outbox'].$GLOBALS['device_name'].'_'.
'34131341'.'.J';
echo $filename;
}
// connect functions to the clicked action of the allocate button
$allocate->connect('clicked', 'get_docket_details');
$allocate->connect('clicked', 'get_address_details1');
$allocate->connect('clicked', 'get_address_details2');
$allocate->connect('clicked', 'get_device_name');
$allocate->connect('clicked', 'send_job');
Gtk::main();
?>
Regards,
Rhys Campbell
DA Systems
e: rhys.campbell@da-systems.co.uk
t: +44(0)1494 512626
f: +44(0)1494 512727
w: www.da-systems.co.uk