1ColorEditor(3)        User Contributed Perl Documentation       ColorEditor(3)
2
3
4

NAME

6       Tk::ColorEditor - a general purpose Tk widget Color Editor
7

SYNOPSIS

9          use Tk::ColorEditor;
10
11          $cref = $mw->ColorEditor(-title => $title, -cursor => @cursor);
12
13          $cref->Show;
14

DESCRIPTION

16       ColorEditor is implemented as an object with various methods, described
17       below.  First, create your ColorEditor object during program
18       initialization (one should be sufficient), and then configure it by
19       specifying a list of Tk widgets to colorize. When it's time to use the
20       editor, invoke the Show() method.
21
22       ColorEditor allows some customization: you may alter the color
23       attribute menu by adding and/or deleting menu items and/or separators,
24       turn the status window on or off, alter the configurator's list of
25       color widgets, or even supply your own custom color configurator
26       callback.
27
28       1.  Call the constructor to create the editor object, which in turn
29           returns a blessed reference to the new object:
30
31              use Tk::ColorEditor;
32
33              $cref = $mw->ColorEditor(
34                  -title  => $title,
35                  -cursor => @cursor,
36              );
37
38                 mw     - a window reference, usually the result of a MainWindow->new
39                          call.  As the default root of a widget tree, $mw and all
40                          descendant widgets at object-creation-time are configured
41                          by the default color configurator procedure.  (You probably
42                          want to change this though or you might end up colorizing
43                          ColorEditor!)
44                 title  - Toplevel title, default = ' '.
45                 cursor - a valid Tk '-cursor' specification (default is
46                          'top_left_arrow').  This cursor is used over all ColorEditor
47                          "hot spots".
48
49       2.  Invoke the configure() method to change editor characteristics:
50
51              $cref->configure(-option => value, ..., -option-n => value-n);
52
53                 options:
54                   -command             : a callback to a  `set_colors' replacement.
55                   -widgets             : a reference to a list of widget references
56                                          for the color configurator.
57                   -display_status      : TRUE IFF display the ColorEditor status
58                                          window when applying colors.
59                   -add_menu_item       : 'SEP', or a color attribute menu item.
60                   -delete_menu_item    : 'SEP', a color attribute menu item, or color
61                                          attribute menu ordinal.
62
63              For example:
64
65                 $cref->configure(-delete_menu_item   => 3,
66                     -delete_menu_item   => 'disabledforeground',
67                     -add_menu_item      => 'SEP',
68                     -add_menu_item      => 'New color attribute',
69                     -widgets            => [$ce, $qu, $f2b2],
70                     -widgets            => [$f2->Descendants],
71                     -command            => [\&my_special_configurator, some, args ]
72                 );
73
74       3.  Invoke the Show() method on the editor object, say, by a button or
75           menu press:
76
77              $cref->Show;
78
79       4.  The cget(-widgets) method returns a reference to a list of widgets
80           that are colorized by the configurator.  Typically, you add new
81           widgets to this list and then use it in a subsequent configure()
82           call to expand your color list.
83
84              $cref->configure(
85                  -widgets => [
86                      @{$Filesystem_ref->cget(-widgets)}, @{$cref->cget(-widgets)},
87                  ]
88              );
89
90       5.  The delete_widgets() method expects a reference to a list of
91           widgets which are then removed from the current color list.
92
93              $cref->delete_widgets($OBJTABLE{$objname}->{'-widgets'})
94

AUTHORS

96       Stephen O. Lidie, Lehigh University Computing Center.  95/03/05
97       lusol@Lehigh.EDU
98
99       Many thanks to Guy Decoux (decoux@moulon.inra.fr) for doing the initial
100       translation of tcolor.tcl to TkPerl, from which this code has been
101       derived.
102
103
104
105perl v5.34.0                      2021-07-23                    ColorEditor(3)
Impressum