[Contents] [Back] [Prev] [Up] [Next] [Forward]

# Package Gtk.Editable

This widget is an abstract widget designed to support the common functionalities of all widgets for editing text. It provides general services to manipulate an editable widget, a large number of action signals used for key bindings, and several signals that an application can connect to to modify the behavior of a widget.

- Gtk.Editable Widget Hierarchy
- Gtk.Editable Signals
- Gtk.Editable Subprograms

## Widget Hierarchy

    Gtk_Object                    (see section Package Gtk.Object)
       \___ Gtk_Widget            (see section Package Gtk.Widget)
          \___ Gtk_Editable       (see section Package Gtk.Editable)

## Signals

- "activate" procedure Handler (Widget : access Gtk_Editable_Record'Class);
  Emitted when the user has activated the widget in some fashion.
- "changed" procedure Handler (Widget : access Gtk_Editable_Record'Class);
  emitted when the user has changed the text of the widget.
- "copy_clipboard" procedure Handler (Widget : access Gtk_Editable_Record'Class);
  Emitting this signal will copy the current selection to the clipboard.
- "cut_clipboard" procedure Handler (Widget : access Gtk_Editable_Record'Class);
  Emitting this signal will cut the current selection to the clipboard.
- "delete_text" procedure Handler (Widget : access Gtk_Editable_Record'Class;
  Start_Pos : in Gint;
  End_Pos : in Gint);
  Emitted when some text is deleted by the user. As for the "insert-text" handler, it is possible to override the default behavior by connecting a handler to this signal, and then stopping the signal.
- "insert_text" procedure Handler (Widget : access Gtk_Editable_Record'Class;
  Text : in String;
  Length : in Gint;
  Position : in Gint_Access);
  Emitted when some text is inserted inside the widget by the user. The default handler inserts the text into the widget. By connecting a handler to this signal, and then by stopping the signal with Gtk.Handlers.Emit_Stop_By_Name, it is possible to modify the inserted text, or even prevent it from being inserted. Position.all should be modified by the callback, and indicates the new position of the cursor after the text has been inserted.
- "kill_char" procedure Handler (Widget : access Gtk_Editable_Record'Class;
  Direction : in Gint);
  Emitting this signal deletes a single character. If Direction is positive, delete forward, else delete backward.
- "kill_line" procedure Handler (Widget : access Gtk_Editable_Record'Class;
  Direction : in Gint);
  Emitting this signal deletes a single line. If Direction is positive, delete forward, otherwise delete backward.
- "kill_word" procedure Handler (Widget : access Gtk_Editable_Record'Class;
  Direction : in Gint);
  Emitting this signal deletes a single word. If Direction is positive, delete forward, otherwise delete backward.
- "move_cursor" procedure Handler (Widget : access Gtk_Editable_Record'Class;
  X, Y : in Gint);
  Emitting this signal will move the cursor position for X characters horizontally, and Y characters vertically.
- "move_page" procedure Handler (Widget : access Gtk_Editable_Record'Class;
  X, Y : in Gint);
  Emitting this signal will move the cursor for X pages horizontally, and Y pages vertically.
- "move_to_column" procedure Handler (Widget : access Gtk_Editable_Record'Class;
  Column : in Gint);
  Emitting this signal will move the cursor to the given column.
- "move_to_row" procedure Handler (Widget : access Gtk_Editable_Record'Class;
  Row : in Gint);
  Emitting this signal will move the cursor to the given row.
- "move_word" procedure Handler (Widget : access Gtk_Editable_Record'Class;
  N : in Gint);
  Emitting this signal will move the cursor by N words (N can be negative).
- "paste_clipboard" procedure Handler (Widget : access Gtk_Editable_Record'Class);
  Emitting this signal will paste the clipboard into the text of the widget at the current cursor position.
- "set-editable" procedure Handler (Widget : access Gtk_Editable_Record'Class;
  Is_Editable: in Boolean);
  Emitting this signal is equivalent to calling Set_Editable.

## Subprograms

    function Get_Type              return Gtk.Gtk_Type;
| Return the internal value associated with a Gtk_Editable.
    procedure Changed
      (Editable           : access Gtk_Editable_Record);
| Cause the "changed" signal to be emitted.
    procedure Claim_Selection
      (Editable           : access Gtk_Editable_Record;
       Claim              : in     Boolean := True;
       Time               : in     Guint32);
| If Claim is set to True, claim the ownership of the primary X selection. Otherwise, release it. "Time" should be set to the time of the last-change time for the specified selection. It is discarded if it is earlier than the current last-change time, or later than the current X server time.
    procedure Copy_Clipboard
      (Editable           : access Gtk_Editable_Record;
       Time               : in     Guint32);
| Copy the characters in the current selection to the clipboard.
    procedure Cut_Clipboard
      (Editable           : access Gtk_Editable_Record;
       Time               : in     Guint32);
| Copy the characters in the current selection to the clipboard. The selection is then deleted.
    procedure Delete_Selection
      (Editable           : access Gtk_Editable_Record);
| Disclaim and delete the current selection.
    procedure Delete_Text
      (Editable           : access Gtk_Editable_Record;
       Start_Pos          : in     Gint := 0;
       End_Pos            : in     Gint := -1);
| Delete the characters from Start_Pos to End_Pos. If End_Pos is negative, the characters are deleted from Start_Pos to the end of the text.
    function Get_Chars
      (Editable           : access Gtk_Editable_Record;
       Start_Pos          : in     Gint := 0;
       End_Pos            : in     Gint := -1)
       return String;
| Get the text from Start_Pos to End_Pos. If End_Pos is negative, the text from Start_Pos to the end is returned.
    function Get_Clipboard_Text
      (Widget             : access Gtk_Editable_Record)
       return String;
| Return the last text copied from the clipboard.
    function Get_Editable
      (Widget             : access Gtk_Editable_Record)
       return Boolean;
| Return True if the widget is editable by the user.
    procedure Set_Editable
      (Widget             : access Gtk_Editable_Record;
       Editable           : in     Boolean := True);
| Set the editable status of the entry. If Editable is False, the user can not modify the contents of the entry. This does not affect the user of the insertion functions above.
    function Get_Has_Selection
      (Widget             : access Gtk_Editable_Record)
       return Boolean;
| Return True if the selection is owned by the widget.
    function Get_Selection_End_Pos
      (Widget             : access Gtk_Editable_Record)
       return Guint;
| Return the position of the end of the current selection.
    function Get_Selection_Start_Pos
      (Widget             : access Gtk_Editable_Record)
       return Guint;
| Return the position of the beginning of the current selection.
    procedure Insert_Text
      (Editable           : access Gtk_Editable_Record;
       New_Text           : in     String;
       Position           : in out Gint);
| Insert the given string at the given position. Position is set to the new cursor position.
    procedure Paste_Clipboard
      (Editable           : access Gtk_Editable_Record;
       Time               : in     Guint32);
| The contents of the clipboard is pasted into the given widget at the current cursor position.
    procedure Select_Region
      (Editable           : access Gtk_Editable_Record;
       Start              : in     Gint;
       The_End            : in     Gint := -1);
| Select the region of text from Start to The_End. The characters that are selected are those characters at positions from Start up to, but not including The_End. If The_End_Pos is negative, then the characters selected will be those characters from Start to the end of the text.
    procedure Set_Position
      (Editable           : access Gtk_Editable_Record;
       Position           :        Gint);
| Change the position of the cursor in the entry. The cursor is displayed before the character with the given index in the widget (the first character has index 0). The value must be less than or equal to the number of characters in the widget. A value of -1 indicates that the position should be set after the last character in the entry. Note that this position is in characters, not in bytes.
    function Get_Position
      (Editable           : access Gtk_Editable_Record)
       return Gint;
| Return the position of the cursor.

[Contents] [Back] [Prev] [Up] [Next] [Forward]