GtkText

GtkText

Editable text-display widget.

Object Hierarchy

GtkObject
`-- GtkWidget
       `-- GtkEditable
              `-- GtkText

Direct subclasses

None.

Description

GtkText provides a scrolling widget with a white background which can have text strings passed to it programmatically or directly from the keyboard (if it is set to be editable). There are a number of keybindings for the editing features; these are listed under GtkEditable, as they are generally shared by the GtkEntry widget.

GtkText is one of two widgets marked as BROKEN throughout the 1.3 series of GTK+ releases, and is being replaced entirely by a new set of text and editing widgets in GTK 2.0. If you can avoid using it, do so. If you can't, be aware that it has issues which are never going to be fixed.

One of these issues is that the horizontal GtkAdjustment does not work in the GtkText widget, and that trying to declare it as anything other than NULL causes the application to stall. There is no problem with the vertical adjustment, and a vertical scrollbar associated with the text widget will work just fine.

Another feature is that it cannot cope with very frequent text updates for long, that being when you're most likely to generate a string that is too big for its XWindow to handle. You may find it better to use a GtkCList if you are using it to display the output for any form of network monitoring, for example.

There is also a problem with the linewrap when the GtkText widget is utilised under Windows, causing it to display 'little black boxes' at every soft wrap. You can get around this by using PHP's wordwrap() function to create a line-end within the GTK line-end, but bear in mind that PHP uses a given number of characters to determine the length of the line, whereas GTK uses pixels to configure the relationship between the font size, the line-end, and the container's border.

See also: GtkEditable, GdkFont, GtkFontSelectionDialog.

A final note: the signal set_scroll_adjustments has not been covered here as it is purely used internally to allow the text widget to communicate with scrolling-aware container widgets.

GtkText has been deprecated since GTK+ 2.0 and should not be used in newly written code.

Constructor

GtkText ([ GtkAdjustment hadj = NULL , [ GtkAdjustment vadj = NULL ]]);
-- Creates a scrollable text widget.

Methods

set_editable()
  Toggles whether text widget is editable.
set_word_wrap()
  Toggles whether words at the end of a line can be broken.
set_line_wrap()
  Toggles whether text should be wrapped at the widget boundary.
set_adjustments()
  Specifies the GtkAdjustments to be used.
set_point()
  Sets insertion point.
get_point()
  Returns the current insertion point.
get_length()
  Returns length of string.
freeze()
  Freezes display.
thaw()
  Thaws display.
insert()
  Inserts a string of text.
backward_delete()
  Deletes characters prior to insertion point.
forward_delete()
  Deletes characters ahead of insertion point.

Properties

hadj:
  Horizontal adjustment. *broken*
vadj:
  Vertical adjustment.

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