GtkText::insert

GtkText::insert

void insert( GdkFont font , GdkColor fore , GdkColor back , string chars, [int length = -1 ]);

This is a complex method offering more control over the appearance of the text in a GtkText widget than the alternative insert_text() inherited from GtkEditable. It also has the bonus that it allows some support for internationalization on all platforms, although multibyte conversion under win32 is not currently included in this.

Any of the first three parameters can be passed as null, making it possible to define only one aspect of the text's appearance, or many.

The first parameter font is a GdkFont. If you are intending to change fonts, you will need to call the static function gdk::font_load() beforehand in order to define your chosen font.

The next two parameters use GdkColor objects to describe the foreground and background colors of the text; again, you will need to define these in order to use them. The first of these is the color of the text itself, the second is the color of the 'page' behind it. Note that setting the back will only change the color for the area that is taken up by the string itself, and not for the entire widget or to the widget's border when the end of the text is reached.

The final two parameters are chars, the string of text to insert; and the optional length, which can be used to limit the extent of the string where it is being input by a user. The default length -1 will allow the entire string.

You can use the current default style with: $text->insert(null, null, null, "A string of text.");

© Copyright 2003-2023 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.