1Prima::Label(3) User Contributed Perl Documentation Prima::Label(3)
2
3
4
6 Prima::Label - static text widget
7
9 The class is designed for display of text, and assumes no user
10 interaction. The text output capabilities include wrapping, horizontal
11 and vertical alignment, and automatic widget resizing to match text
12 extension. If text contains a tilde-escaped ( hot ) character, the
13 label can explicitly focus the specified widget upon press of the
14 character key, what feature is useful for dialog design.
15
17 use Prima qw(Label InputLine Application);
18 my $w = Prima::MainWindow->new;
19 $w->insert( 'Prima::Label',
20 text => 'Enter ~name:',
21 focusLink => 'InputLine1',
22 alignment => ta::Center,
23 pack => { fill => 'x', side => 'top', pad => 10 },
24 );
25 $w->insert(
26 'Prima::InputLine',
27 text => '',
28 pack => { fill => 'x', side => 'top', pad => 10 },
29 );
30 run Prima;
31
33 Properties
34 alignment INTEGER
35 One of the following "ta::XXX" constants:
36
37 ta::Left
38 ta::Center
39 ta::Right
40
41 Selects the horizontal text alignment.
42
43 Default value: "ta::Left"
44
45 autoHeight BOOLEAN
46 If 1, the widget height is automatically changed as text extensions
47 change.
48
49 Default value: 0
50
51 autoWidth BOOLEAN
52 If 1, the widget width is automatically changed as text extensions
53 change.
54
55 Default value: 1
56
57 focusLink WIDGET
58 Points to a widget or a widget name (has to be a sibling widget),
59 which is explicitly focused when the user presses the combination
60 of a hot key with the "Alt" key.
61
62 Prima::Label does not provide a separate property to access the hot
63 key value, however it can be read from the "{accel}" variable.
64
65 Default value: "undef".
66
67 hotKey CHAR
68 A key that the label will react to if pressed, even when out of
69 focus.
70
71 showAccelChar BOOLEAN
72 If 0, the tilde ( ~ ) character is collapsed from the text, and the
73 hot character is underlined. When the user presses combination of
74 the escaped character with the "Alt" key, the "focusLink" widget is
75 explicitly focused.
76
77 If 1, the text is showed as is, and no hot character is underlined.
78 Key combinations with "Alt" key are not recognized. See also:
79 "hotKey".
80
81 Default value: 0
82
83 showPartial BOOLEAN
84 Used to determine if the last line of text should be drawn if it
85 can not be vertically fit in the widget interior. If 1, the last
86 line is shown even if not visible in full. If 0, only full lines
87 are drawn.
88
89 Default value: 1
90
91 textJustify $BOOL | { letter => 0, word => 0, kashida => 0, min_kashida
92 => 0 } | %VALUES
93 If set, justifies wrapped text according to the option passwd in
94 the hash ( see "arabic_justify" in Prima::Drawable::Glyphs and
95 "interspace_justify" in Prima::Drawable::Glyphs ). Can accept
96 three forms:
97
98 If anonymous hash is used, overwrites all the currently defined
99 options.
100
101 If $BOOL is used, treated as a shortcut for "{ letter => $BOOL,
102 word => $BOOL, kashida => $BOOL }"; consequent get-calls return
103 full hash, not the $BOOL.
104
105 If %VALUES form is used, overwrites only values found in %VALUES.
106
107 Only actual when "wordWrap" is set.
108
109 textDirection BOOLEAN
110 If set, indicates RTL text direction.
111
112 wordWrap BOOLEAN
113 If 1, the text is wrapped if it can not be horizontally fit in the
114 widget interior.
115
116 If 0, the text is not wrapped unless new line characters are
117 present in the text.
118
119 New line characters signal line wrapping with no respect to
120 "wordWrap" property value.
121
122 Default value: 0
123
124 valignment INTEGER
125 One of the following "ta::XXX" constants:
126
127 ta::Top
128 ta::Middle or ta::Center
129 ta::Bottom
130
131 Selects the vertical text alignment.
132
133 NB: "ta::Middle" value is not equal to "ta::Center"'s, however the
134 both constants produce equal effect here.
135
136 Default value: "ta::Top"
137
139 Dmitry Karasik, <dmitry@karasik.eu.org>.
140
142 Prima, Prima::Widget, examples/label.pl
143
144
145
146perl v5.34.0 2021-07-22 Prima::Label(3)