Re: GtkText Problem - Getting the text

From: Date: Thu, 27 Dec 2001 16:32:18 +0000
Subject: Re: GtkText Problem - Getting the text
References: 1 2  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-928@lists.php.net to get a copy of this message
Thanks Anson .... but I think I did somthing wrong.(newbie problems :-) ) I'd be glad if you could look at it and show me the problem. Thanks .. Sascha Here's my script <? if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') dl('php_gtk.dll'); else dl('php_gtk.so'); function gettext($text1, $text2) { global $text1; global $text2; global $string; $text1->freeze(); $string = $text1->get_chars(0,-1); $text2->insert_text($string); $text1->thaw(); } // Mainwindow $window = &new GtkWindow(); $window->connect_object('destroy', array('gtk', 'main_quit')); $window->set_usize(450, 500); $window->set_title('Sascha'); $window->set_name('MainWindow'); // MainTable $table = &new GtkTable(1, 3, false); $table->set_row_spacing(0,2); $table->set_col_spacing(0,2); $window->add($table); // Insert-Text Area ... $text1 = &new GtkText(); $text1->set_editable(True); $text1->connect('activate','gettext'); $table->attach($text1, 0, 1, 0, 1, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); // Button ... $button = &new GtkButton('Display ...'); $button->connect_object('clicked', 'gettext' , $text1 , $text2); $table->attach($button, 0, 1, 1, 2, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); // Text Area for output ... $text2 = &new GtkText(); $text2->connect('activate','gettext'); $table->attach($text2, 0, 1, 2, 3, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); $window->show_all(); Gtk::main(); ?> ----- Original Message ----- From: "Anson Rinesmith" <anson@lddcorp.com> To: "sascha schulz" <s.schulz@ooe.net> Cc: "PHP GTK GENERAL" <php-gtk-general@lists.php.net> Sent: Thursday, December 27, 2001 4:04 PM Subject: Re: [PHP-GTK] GtkText Problem - Getting the text > TO GET THE TEXT > gchar* gtk_editable_get_chars (GtkEditable *editable, gint > start_pos, gint end_pos); > > Retrieves a sequence of characters. The characters that are retrieved are > those characters at positions from start_pos up to, but not including > end_pos. If end_pos is negative, then the the characters retrieved will be > those characters from start_pos to the end of the text. > > // To get the whole box of text. > $textstring = $textbox1->get_chars(0,-1); > > TO DISPLAY THE TEXT > void gtk_editable_insert_text (GtkEditable *editable, const > gchar *new_text, gint new_text_length, gint *position); > > Insert text at a given position. > > // To display text > $textbox2->insert_text($textstring) > > -- > PHP-GTK General Mailing List (http://gtk.php.net/) > To unsubscribe, e-mail: php-gtk-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-gtk-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

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