1Prima::InputLine(3) User Contributed Perl Documentation Prima::InputLine(3)
2
3
4
6 Prima::InputLine - standard input line widget
7
8 SYNOPSIS
9 use Prima qw(InputLine Application);
10 Prima::InputLine-> new( text => 'Hello world!');
11 run Prima;
12
14 The class provides basic functionality of an input line, including
15 hidden input, read-only state, selection, and clipboard operations. The
16 input line text data is contained in text property.
17
19 Events
20 Change
21 The notification is called when the text property is changed,
22 either interactively or as a result of direct call.
23
24 Validate TEXT_REF
25 The notification is called right before the text property is
26 changed, either interactively or as a result of direct call. The
27 custom code has a chance to validate the text and/or provide some
28 sort of interactive feedback.
29
30 See also: "blink"
31
32 Properties
33 alignment INTEGER
34 One of the following "ta::" constants, defining the text alignment:
35
36 ta::Left
37 ta::Right
38 ta::Center
39
40 Default value: "ta::Left"
41
42 autoHeight BOOLEAN
43 If 1, adjusts the height of the widget automatically when its font
44 changes.
45
46 Default value: 1
47
48 autoSelect BOOLEAN
49 If 1, all the text is selected when the widget becomes focused.
50
51 Default value: 1
52
53 autoTab BOOLEAN
54 If 1, the keyboard "kb::Left" and "kb::Right" commands, if received
55 when the cursor is at the beginning or at the end of text, and
56 cannot be mover farther, not processed. The result of this is that
57 the default handler moves focus to a neighbor widget, in a way as
58 if the Tab key was pressed.
59
60 Default value: 0
61
62 borderWidth INTEGER
63 Width of 3d-shade border around the widget.
64
65 Default value: 2
66
67 charOffset INTEGER
68 charOffset gets the current position of the cursor charOffset N
69 sets the cursor at position N
70
71 firstChar
72 Selects the first visible cluster of text
73
74 insertMode BOOLEAN
75 Governs the typing mode - if 1, the typed text is inserted, if 0,
76 the text overwrites the old text. When "insertMode" is 0, the
77 cursor shape is thick and covers the whole character; when 1, it is
78 of default width.
79
80 Default toggle key: Insert
81
82 maxLen INTEGER
83 The maximal length of the text, that can be stored into text or
84 typed by the user.
85
86 Default value: 256
87
88 passwordChar CHARACTER
89 A character to be shown instead of the text letters when writeOnly
90 property value is 1.
91
92 Default value: '*'
93
94 readOnly BOOLEAN
95 If 1, the text cannot be edited by the user.
96
97 Default value: 0
98
99 selection START, END
100 Two integers, specifying the beginning and the end of the selected
101 text, in clusters. A case with no selection is when START equals
102 END.
103
104 selStart INTEGER
105 Selects the start of text selection.
106
107 selEnd INTEGER
108 Selects the end of text selection.
109
110 textDirection BOOLEAN
111 If set, indicates RTL text input.
112
113 textLigation BOOLEAN
114 If set, text may be rendered at better quality with ligation and
115 kerning, however that comes with a price that some ligatures may be
116 indivisible and form clusters (f.ex. ff or ffi ligatures). Cursor
117 cannot go inside of such clusters, and thus one can only select
118 them, delete as whole, or press Del/Backspace on the cluster's
119 edge.
120
121 Toggle during runtime with Ctrl+Shift+L.
122
123 wordDelimiters STRING
124 Contains string of character that are used for locating a word
125 break. Default STRING value consists of punctuation marks, space
126 and tab characters, and "\xff" character.
127
128 writeOnly BOOLEAN
129 If 1, the input is not shown but mapped to passwordChar characters.
130 Useful for a password entry.
131
132 Default value: 0
133
134 Methods
135 blink %options
136 Produces a short blink by setting background to red color. Can be
137 used to signal invalid input, f ex from "on_validate". %options
138 allows "backColor" and "color" entries.
139
140 copy
141 Copies the selected text, if any, to the clipboard.
142
143 Default key: Ctrl+Insert
144
145 cut Cuts the selected text into the clipboard.
146
147 Default key: Shift+Delete
148
149 delete
150 Removes the selected text.
151
152 Default key: Delete
153
154 paste
155 Copies text from the clipboard and inserts it in the cursor
156 position.
157
158 Default key: Shift+Insert
159
160 select_all
161 Selects all text
162
163 Bi-directional input and output
164 When working on bidirectional texts, or text represented by complex
165 script shaping, methods "firstChar", "charOffset", "selection" etc
166 cannot be used to calculate text offsets f.ex. via "substr". Note that
167 these values are in clusters, not in characters (see
168 Prima::Drawable::Glyphs for the description>. Also, selection ranges of
169 bidi text become not straighforward. Use the following methods
170 whenever text manipulations are needed:
171
172 char_at OFFSET
173 Returns character at OFFSET
174
175 selection_strpos
176 Returns range of characters covered by the selection.
177
179 Dmitry Karasik, <dmitry@karasik.eu.org>.
180
182 Prima, Prima::Widget, examples/edit.pl.
183
184
185
186perl v5.38.0 2023-07-21 Prima::InputLine(3)