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 wordWrap BOOLEAN
92 If 1, the text is wrapped if it can not be horizontally fit in the
93 widget interior.
94
95 If 0, the text is not wrapped unless new line characters are
96 present in the text.
97
98 New line characters signal line wrapping with no respect to
99 "wordWrap" property value.
100
101 Default value: 0
102
103 valignment INTEGER
104 One of the following "ta::XXX" constants:
105
106 ta::Top
107 ta::Middle or ta::Center
108 ta::Bottom
109
110 Selects the vertical text alignment.
111
112 NB: "ta::Middle" value is not equal to "ta::Center"'s, however the
113 both constants produce equal effect here.
114
115 Default value: "ta::Top"
116
118 Dmitry Karasik, <dmitry@karasik.eu.org>.
119
121 Prima, Prima::Widget, examples/label.pl
122
123
124
125perl v5.30.0 2019-08-21 Prima::Label(3)