1Prima::Tie(3) User Contributed Perl Documentation Prima::Tie(3)
2
3
4
6 Prima::Tie - tie widget properties to scalars or arrays.
7
9 Prima::Tie contains two abstract classes, "Prima::Tie::Array" and
10 "Prima::Tie::Scalar", which tie an array or a scalar to a widget's
11 arbitrary array or scalar property. Also, it contains classes
12 "Prima::Tie::items", "Prima::Tie::text", and "Prima::Tie::value", which
13 tie a variable to a widget's items, text, and value property
14 respectively.
15
17 use Prima::Tie;
18
19 tie @items, 'Prima::Tie::items', $widget;
20
21 tie @some_property, 'Prima::Tie::Array', $widget, 'some_property';
22
23 tie $text, 'Prima::Tie::text', $widget;
24
25 tie $some_property, 'Prima::Tie::Scalar', $widget, 'some_property';
26
28 These classes provide immediate access to a widget's array and scalar
29 property, in particular to popular properties as items and text. It is
30 considerably simpler to say
31
32 splice(@items,3,1,'new item');
33
34 than to say
35
36 my @i = @{$widget->items};
37 splice(@i,3,1,'new item');
38 $widget->items(\@i);
39
40 You can work directly with the text or items rather than at a remove.
41 Furthermore, if the only reason you keep an object around after
42 creation is to access its text or items, you no no longer need to do
43 so:
44
45 tie @some_array, 'Prima::Tie::items', Prima::ListBox->create(@args);
46
47 As opposed to:
48
49 my $widget = Prima::ListBox->create(@args);
50 tie @some_array, 'Prima::Tie::items', $widget;
51
52 "Prima::Tie::items" requires "::items" property to be available on the
53 widget. Also, it takes advantage of additional "get_items",
54 "add_items", and the like if available.
55
56 Prima::Tie::items
57 The class is applicable to "Prima::ListViewer", "Prima::ListBox",
58 "Prima::Widget::Header", and their descendants, and in limited fashion
59 to "Prima::OutlineViewer" and its descendants "Prima::StringOutline"
60 and "Prima::Outline".
61
62 Prima::Tie::text
63 The class is applicable to any widget.
64
65 Prima::Tie::value
66 The class is applicable to "Prima::GroupBox",
67 "Prima::Dialog::ColorDialog", "Prima::SpinEdit", "Prima::Gauge",
68 "Prima::Slider", "Prima::CircularSlider", and "Prima::ScrollBar".
69
71 Copyright 2004 Teo Sankaro
72
73 This program is distributed under the BSD License. (Although a credit
74 would be nice.)
75
77 Teo Sankaro, <teo_sankaro@hotmail.com>. Dmitry Karasik,
78 <dmitry@karasik.eu.org>.
79
80
81
82perl v5.38.0 2023-07-21 Prima::Tie(3)