Prima::InputLine(3)
π NAME π
Okay bestie, welcome to the Prima::InputLine(3) page β this is the User Contributed Perl Documentation version, and it's all about the input line widget. The name is literally Prima::InputLine β input line widget. Iconic. π
β¨ SYNOPSIS β¨
Here's the tiny starter pack, copy-paste ready:
use Prima qw(InputLine Application);
Prima::InputLine-> new( text => 'Hello world!');
run Prima;
πΈ DESCRIPTION πΈ
The class provides the basic functionality of an input line, including hidden input, read-only state, selection, and clipboard operations. The input line text data is stored in the text property. No cap, that's the whole vibe. π
π οΈ API π οΈ
This is the API section β events, properties, methods, and the whole lore. Let's go. π¦
π¦ Events π¦
Changeβ the notification is called when thetextproperty is changed, either interactively or as a result of a direct call.Validate TEXT_REFβ the notification is called right before thetextproperty is changed, either interactively or as a result of a direct call. The custom code has a chance to validate the text and/or provide some sort of interactive feedback. See also:blink.
πΈ Properties πΈ
These are the properties, and yes, we're going through every single one. Defaults included. Periodt. β¨
alignment INTEGERβ one of the followingta::constants, defining the text alignment:
ta::Left
ta::Right
ta::Center
Default value: ta::Left.
autoHeight BOOLEANβ if1, adjusts the height of the widget automatically when its font changes. Default value:1.autoSelect BOOLEANβ if1, all the text is selected when the widget becomes focused. Default value:1.autoTab BOOLEANβ if1, ignores the keyboardkb::Leftandkb::Rightcommands, when these are received when the cursor is at the beginning or the end of text and cannot be moved farther. The result of this is that the default handler moves focus to a neighbor widget, in a way as if the Tab key was pressed. Default value:0.borderWidth INTEGERβ width of the border around the widget. Default value: depends on the skin.charOffset INTEGERβ managets the current position of the cursor. Yes, "managets" β that's what the page says, and we respect the spelling. πfirstCharβ selects the first visible cluster of text.insertMode BOOLEANβ manages the typing mode β if1, the typed text is inserted, if0, the text overwrites the old text. WheninsertModeis0the cursor shape is thick and covers the whole character; when1, it is of the default width. Default toggle key: Insert (Insert).maxLen INTEGERβ the maximal length of the text, that can be stored into text or typed by the user. Default value:256.passwordChar CHARACTERβ a character to be shown instead of the text letters whenwriteOnlyproperty value is1. Default value:'*'.readOnly BOOLEANβ if1, the text cannot be edited by the user. Default value:0.selection START, ENDβ two integers, specifying the beginning and the end of the selected text, in clusters. A case with no selection is whenSTARTequalsEND.selStart INTEGERβ selects the start of the text selection.selEnd INTEGERβ selects the end of the text selection.textDirection BOOLEANβ if set, indicates RTL text input.textLigation BOOLEANβ if set, text may be rendered at better quality with ligation and kerning, however, that comes with a price that some ligatures may be indivisible and form clusters (f.ex.fforffiligatures). The cursor cannot go inside such clusters, and thus one can only select them, delete them as a whole, or press Del/Backspace on the cluster's edge. Toggle during runtime with Ctrl+Shift+L (Ctrl+Shift+L).wordDelimiters STRINGβ contains the string of characters that are used for locating a word break. DefaultSTRINGvalue consists of punctuation marks, space, tab, and"\xff"character.writeOnly BOOLEANβ if1, the input is not shown but mapped topasswordCharcharacters. Useful for a password entry. Default value:0.
π Methods π
blink %optionsβ produces a short blink by setting the background to red color. Can be used to signal an invalid input, f ex fromon_validate.%optionsallows thebackColorandcolorentries.copyβ copies the selected text, if any, to the clipboard. Default key: Ctrl+Insert (Ctrl+Insert).cutβ cuts the selected text into the clipboard. Default key: Shift+Delete (Shift+Delete).deleteβ removes the selected text. Default key: Delete (Delete).pasteβ copies text from the clipboard and inserts it in the cursor position. Default key: Shift+Insert (Shift+Insert).select_allβ selects all text.
π Bi-directional input and output π
When working on bidirectional texts, or text represented by complex script shaping, values returned from the methods firstChar, charOffset, selection, etc cannot be used to calculate text offsets f.ex. via substr. Note that these values are in clusters, not in characters (see Prima::Drawable::Glyphs for the description>). Also, the selection ranges of bidi text become not straightforward. Use the following methods whenever text manipulations are needed:
char_at OFFSETβ returns character at clusterOFFSET.selection_strposβ returns range of characters covered by the selection.
π AUTHOR π
Dmitry Karasik, <dmitry@karasik.eu.org>. π
π SEE ALSO π
Prima, Prima::Widget, examples/edit.pl. Go forth and vibe-check the rest of the docs, bestie. π«Ά
π That's the whole page! Signing off with perl v5.42.0, dated 2024-08-20, and the page tag Prima::InputLine(3). Catch you in the group chat! π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms