1Gtk2::Editable(3)     User Contributed Perl Documentation    Gtk2::Editable(3)
2
3
4

NAME

6       Gtk2::Editable - wrapper for GtkEditable
7

HIERARCHY

9         Glib::Interface
10         +----Gtk2::Editable
11

METHODS

13   string = $editable->get_chars ($start_pos, $end_pos)
14       ·   $start_pos (integer)
15
16       ·   $end_pos (integer)
17
18   $editable->copy_clipboard
19   $editable->cut_clipboard
20   $editable->delete_selection
21   $editable->delete_text ($start_pos, $end_pos)
22       ·   $start_pos (integer)
23
24       ·   $end_pos (integer)
25
26   boolean = $editable->get_editable
27   $editable->set_editable ($is_editable)
28       ·   $is_editable (boolean)
29
30   new_position = $editable->insert_text (new_text, position)
31       ·   $new_text (string)
32
33       ·   ... (list)
34
35   $editable->paste_clipboard
36   integer = $editable->get_position
37   $editable->set_position ($position)
38       ·   $position (integer)
39
40   $editable->select_region ($start, $end)
41       ·   $start (integer)
42
43       ·   $end (integer)
44
45   (start, end) = $editable->get_selection_bounds
46       Returns integers, start and end.
47

SIGNALS

49       changed (Gtk2::Editable)
50       delete-text (Gtk2::Editable, integer, integer)
51       insert-text (Gtk2::Editable, string, integer, gpointer)
52
53       The "insert-text" signal handler can optionally alter the text to be
54       inserted.  It may
55
56       ·   Return no values for no change.  Be sure to end with an empty
57           "return".
58
59               sub my_insert_text_handler {
60                 my ($widget, $text, $len, $pos, $userdata) = @_;
61                 print "inserting '$text' at char position '$pos'\n";
62                 return;  # no values
63               }
64
65       ·   Return two values "($text, $pos)" which are the new text and
66           character position.
67
68               sub my_insert_text_handler {
69                 my ($widget, $text, $len, $pos, $userdata) = @_;
70                 return (uc($text), $pos);  # force to upper case
71               }
72
73       ·   Return no values and modify the text in $_[1] and/or position in
74           $_[3].  For example,
75
76               sub my_insert_text_handler {
77                 $_[1] = uc($_[1]);   # force to upper case
78                 $_[3] = 0;           # force position to the start
79                 return;  # no values
80               }
81
82       Note that currently in a Perl subclass of a "Gtk2::Editable" widget, a
83       class closure (ie. class default signal handler) for "insert-text" does
84       not work this way.  It instead sees the C level "($text, $len,
85       $pos_pointer)", where $pos_pointer is a machine address and cannot be
86       used easily.  Hopefully this will change in the future.  A
87       "signal_chain_from_overridden" with the args as passed works, but for
88       anything else the suggestion is to use a "signal_connect" instead.
89

SEE ALSO

91       Gtk2, Glib::Interface
92
94       Copyright (C) 2003-2011 by the gtk2-perl team.
95
96       This software is licensed under the LGPL.  See Gtk2 for a full notice.
97
98
99
100perl v5.30.1                      2020-01-30                 Gtk2::Editable(3)
Impressum