Re: Insert texte in a Text widget
| From: | baris karakaya | Date: | Sat, 10 Mar 2001 13:37:09 +0000 |
| Subject: | Re: Insert texte in a Text widget | ||
| References: | 1 | Groups: | php.gtk |
| Request: | Send a blank email to php-gtk+get-657@lists.php.net to get a copy of this message | ||
I create the text editor with editable except 1-2 warning messages. My platform is linux and I write
the line
$text = &new GtkText();
not with NULL, I guess if you give no parameter the vertical and horizantal GTKAdjustment
parameters
are given by text object itself.
I made it and it executes. Please try it yourself...
regards...
Pierre-Maxime BIAU wrote:
> 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();
> ?>