= 4.1.0) on Windows platforms. * * 2004 by Roberto Rossi - http://rsoftware.altervista.org * * Run with PHP. Start with 'PHP demostdin.php'. * Revised for GTK-server 1.2 October 7, 2004 * Revised for GTK-server 1.3 December 6, 2004 *********************************************************************/ error_reporting(E_ALL); $descriptorspec = array( 0 => array("pipe", "r"), // stdin is a pipe that the child will read from 1 => array("pipe", "w"), // stdout is a pipe that the child will write to 2 => array("file", "c:/temp/error-output.txt", "a"), // stderr is a file to write to ); //Send/Receive Message To/From Gtk Server function Gtk_Msg($msg) { global $pipes; fwrite($pipes[0], $msg."\n"); $ret=fgets($pipes[1],1024); if (!$ret) exit(); $ret = substr($ret, 0, strlen($ret)-2); return $ret; } $process = proc_open("gtk-server.exe -stdin", $descriptorspec, $pipes); if (!is_resource($process)) exit(); echo("Connection \n"); $tmp = ''; Gtk_Msg("gtk_init NULL NULL"); //window creation $win = Gtk_Msg("gtk_window_new 0"); Gtk_Msg("gtk_window_set_title ".$win." GTKserver-Demo"); Gtk_Msg("gtk_widget_set_usize ".$win." 450 400"); //table creation $table = Gtk_Msg("gtk_table_new 3 3 1"); Gtk_Msg("gtk_container_add ".$win." ".$table); //button creation $button=Gtk_Msg("gtk_button_new_with_label Exit"); Gtk_Msg("gtk_table_attach_defaults ".$table." ".$button." 41 49 45 49"); //entry creation $entry=Gtk_Msg("gtk_entry_new"); Gtk_Msg("gtk_table_attach_defaults ".$table." ".$entry." 1 40 45 49"); //text creation $text=Gtk_Msg("gtk_text_new NULL NULL"); Gtk_Msg("gtk_table_attach_defaults ".$table." ".$text." 1 49 8 44"); //radio creation $radio1=Gtk_Msg("gtk_radio_button_new_with_label_from_widget NULL Yes"); Gtk_Msg("gtk_table_attach_defaults ".$table." ".$radio1." 1 10 1 3"); $radio2=Gtk_Msg("gtk_radio_button_new_with_label_from_widget ".$radio1." No"); Gtk_Msg("gtk_table_attach_defaults ".$table." ".$radio2." 1 10 4 7"); //Show All Object Gtk_Msg("gtk_widget_show_all ".$win); do { $event=Gtk_Msg("gtk_server_callback WAIT"); if ($event==$entry) { $tmp=Gtk_Msg("gtk_entry_get_text ".$entry); Gtk_Msg("gtk_text_insert ".$text." NULL NULL NULL ".$tmp." -1"); Gtk_Msg("gtk_editable_delete_text ".$entry." 0 -1"); } } while (($event!=$win) && ($event!=$button)); echo "Closing connection..."; fclose($pipes[0]); fclose($pipes[1]); proc_close ($process); echo "End.\n\n"; ?>