Insert texte in a Text widget

From: Date: Sat, 10 Mar 2001 13:21:00 +0000
Subject: Insert texte in a Text widget
Groups: php.gtk 
Request: Send a blank email to php-gtk+get-656@lists.php.net to get a copy of this message
Hi, I a m trying to create a very simple text editor, and have problem with the insert method of the Text widget: To use it, it seems that I need to give a gdkfont and color as arguments, but dont know how to do. I tried to give null as params but that doesnt work. I finally found how to get a valid gdkfont (though there should be better solutions!) but I am blocked with colors. Here is my code: ------------- snip ------------------snip ---------------- snip--------------- <? // loading extension if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') dl('php_gtk.dll'); else dl('php_gtk.so'); // my window... $window=&new GtkWindow(); $window->set_usize( 600, 300 ); $window->set_title( "Text editor Exemple" ); // My text field $text = &new GtkText( NULL, NULL); $text->set_editable( true ); $window->add($text); $text->show(); // How I got my gdkfont var... Ugly isn't it ? $font_selection = &new GtkFontSelection(); $temp=$font_selection->set_font_name("-unknown-Arial-bold-o-normal--18-135-96-96-p-0-iso8859-9"); $myfont=$font_selection->get_font(); // Now I want to insert my string. Myfont is ok, but my colors are still un-defined... $text->insert($myfont,$col1,$col2,'uiyuyi'); $window->show(); Gtk::main(); ?> ------------- snip ------------------snip ---------------- snip---------------

« previous php.gtk (#656) next »