Re: PHP-GTK2 new Example 11. Using get_char_count() to manual...
| From: | PPK-Webprogramm CH Gordevio www.ciz.ch | Date: | Wed, 26 Oct 2005 17:18:48 +0000 |
| Subject: | Re: PHP-GTK2 new Example 11. Using get_char_count() to manual... | ||
| References: | 1 2 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-6288@lists.php.net to get a copy of this message | ||
Scott Mattocks ha scritto:
PPK-Webprogramm CH Gordevio www.ciz.ch wrote:but wen input from GtkTextView() is not unicode or utf-8 the api crash .... any time inside GtkTextView right click method input window ime ???? basic class http://ciz.ch/svnciz/new_php_gtk2/xmleditor/demo_get_char_count2.php extends http://ciz.ch/svnciz/new_php_gtk2/xmleditor/inc_class/Setup_XML_Editor.php buffer text to get and to put is ok .... now i continue to find out to highlightSource xml xslt fop php already from cvs php-gtk2 phpgtk2-demo.php function __construct() {but i not know how to get GtkTextBuffer to save file :-(I found solution..... :-) idea from cvs php-gtk2 test/bug_gtktextbuffer_move_mark_by_name_selection_bound.php
parent::__construct();
$this->__Buffer_0->connect('mark-set',array(&$this,"Window_captureEvents"));
......
}
function Window_captureEvents() { //// name similar from javascript to know-hot wath make /////
$iter1 = $this->__Buffer_0->get_iter_at_offset(0);
$iter2 = $this->__Buffer_0->get_iter_at_offset($this->__Buffer_0->get_char_count());
$Actual_Cache = $this->__Buffer_0->get_text($iter1,$iter2);
if (strlen($Actual_Cache) > '0') {
@file_put_contents($this->Cache_File,$Actual_Cache); //// rand file name ///
}
}
function __destruct() {
/////$this->Message_Box_Info('See you next time... have a nice day.');
if (is_file($this->Cache_File)) {
@unlink($this->Cache_File); /// delete file by exit
}
}
GtkTextBuffer doesn't save files. It manages text. If you want to save a file get the contents of the buffer and then use some other class/method to save the file (file_put_contents). Don't forget to call GtkTextBuffer::set_modified(false) after saving the information. Scott