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