Straasha
Joined: 27 Apr 2006 Posts: 2
|
Posted: Thu Apr 27, 2006 9:59 am Post subject: Pb for getting textview |
|
|
Hi all,
I begin the PHP GTK2 and i have problem to copie a GtkTextView :
| Quote: | <?php
include("connexion.php");
$GLOBALS['button1'];
$GLOBALS['show_2003'];
$GLOBALS['show_xp'];
$GLOBALS['migrate_computer_xp'];
$GLOBALS['fixed1'];
$GLOBALS['label2'];
$GLOBALS['Netbios'];
$GLOBALS['label4'];
$GLOBALS['label5'];
$GLOBALS['Site'];
$GLOBALS['SiteName'];
$GLOBALS['titre_action'];
$GLOBALS['result_action'];
$GLOBALS['textview'];
$GLOBALS['buffer'];
if (!class_exists('gtk')) {
die("le module php-gtk2 n'est pas disponible. rn");
}
function exit_app() {
gtk::main_quit();
}
function affiche() {
$GLOBALS['label2']->set_text($GLOBALS['Netbios']);
$GLOBALS['label4']->set_text($GLOBALS['SiteName']);
}
function affichexp(){
$GLOBALS['titre_action']->set_text("Xp computers list on your site");
$textBuffer = new GtkTextBuffer();
$SQL_server = "S101A158";
mssql_connect($SQL_server, *, *);
mssql_select_db('SMS_101');
$result = mssql_query("SELECT * FROM _RES_COLL_101000BA WHERE Name like '%".$GLOBALS[Site]."%' ORDER BY Name");
$text ="";
while($val = mssql_fetch_array($result)){
$text = $text.$val['Name']."\n";
}
$textBuffer->set_text($text);
$GLOBALS['result_action']->set_buffer($textBuffer);
//$GLOBALS['textview']->set_buffer($textBuffer);
$GLOBALS['result_action']->set_editable(false);
//$GLOBALS['button']->hide();
}
function migxp(){
$GLOBALS['titre_action']->set_text("Add Xp computers to migrate");
$textBuffer = new GtkTextBuffer();
$text ="";
$textBuffer->set_text($text);
$GLOBALS['result_action']->set_buffer($textBuffer);
$GLOBALS['result_action']->set_editable(true);
$GLOBALS['result_action']->set_cursor_visible(true);
//$GLOBALS['button']->show();
}
function addxp(){
$test = $GLOBALS['result_action']->get_text();
$textBuffer = new GtkTextBuffer();
$textBuffer->set_text($test);
$GLOBALS['textview']->set_buffer($textBuffer);
}
function afficheoff(){
$GLOBALS['titre_action']->set_text("Xp office 2003 list on your site");
$textBuffer = new GtkTextBuffer();
$SQL_server = "S101A158";
mssql_connect($SQL_server, *, *);
mssql_select_db('SMS_101');
$result = mssql_query("SELECT * FROM _RES_COLL_10100110 WHERE Name like '%".$GLOBALS[Site]."%' ORDER BY Name");
$text ="";
while($val = mssql_fetch_array($result)){
$text = $text.$val['Name']."\n";
}
$textBuffer->set_text($text);
$GLOBALS['result_action']->set_buffer($textBuffer);
$GLOBALS['result_action']->set_editable(false);
//$GLOBALS['button']->hide();
}
//Récupération du nom de la machine
$GLOBALS['Netbios'] = getenv("COMPUTERNAME");
$GLOBALS['Site'] = substr($GLOBALS['Netbios'], 1, 3);
//Attribution du site
if ($GLOBALS['Site'] == "101") {
$GLOBALS['SiteName'] = "Lestrem";
}
$GLOBALS['SiteName'] = $GLOBALS['Site']." => ".$GLOBALS['SiteName'];
//Chargement de l'interface graphique
$glade = new GladeXML('projects.glade');
//Récupération des infos du constructeur
$window = $glade->get_widget('window1');
$GLOBALS['fixed1'] = $glade->get_widget('fixed1');
$GLOBALS['button1'] = $glade->get_widget('button1');
$GLOBALS['show_xp'] = $glade->get_widget('show_all_xp_computer');
$GLOBALS['migrate_computer_xp'] = $glade->get_widget('migrate_computer_xp');
$GLOBALS['show_2003'] = $glade->get_widget('show_all_office_2003_computer');
$GLOBALS['label2'] = $glade->get_widget('label2');//label netbios
$GLOBALS['label4'] = $glade->get_widget('label4');//label site
$GLOBALS['label5'] = $glade->get_widget('label5');
$GLOBALS['titre_action'] = $glade->get_widget('titre_action');
$GLOBALS['result_action'] = $glade->get_widget('result_action');
$GLOBALS['textview'] = $glade->get_widget('textview');
$window->connect_simple('destroy', array('gtk', 'main_quit'));
$GLOBALS['show_xp']->connect_simple('activate', 'affichexp');
$GLOBALS['migrate_computer_xp']->connect_simple('activate', 'migxp');
$GLOBALS['button1']->connect_simple('clicked', 'addxp');
$GLOBALS['show_2003']->connect_simple('activate', 'afficheoff');
$glade->signal_autoconnect($window);
affiche();
gtk::main();
?> |
Can you help me for copie the GtkTextView $GLOBALS['result_action'] to the GtkTextView $GLOBALS['textview'] with the button1 and addxp function ??
Thx !!! |
|