| 1 |
# Copyright (c) 1996 Sun Microsystems, Inc. |
| 2 |
# See the file "license.terms" for information on usage and redistribution |
| 3 |
# of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 4 |
# |
| 5 |
# |
| 6 |
|
| 7 |
=head1 NAME |
| 8 |
|
| 9 |
Tk::chooseColor - pops up a dialog box for the user to select a color. |
| 10 |
|
| 11 |
=for category Popups and Dialogs |
| 12 |
|
| 13 |
=head1 SYNOPSIS |
| 14 |
|
| 15 |
S< >I<$color> = I<$widget>-E<gt>B<chooseColor>?(I<-option>=E<gt>I<value>, ...)?; |
| 16 |
|
| 17 |
=head1 DESCRIPTION |
| 18 |
|
| 19 |
The method B<chooseColor> is implemented as a perl wrapper |
| 20 |
on the core tk "command" B<tk_chooseColor>, and I<$widget> |
| 21 |
is passed as the argument to the hidden B<-parent> option. |
| 22 |
The implementation of internal B<tk_chooseColor> is platform |
| 23 |
specific, on Win32 it is a native dialog, and on UNIX/X11 it is implemented |
| 24 |
in terms of L<Tk::ColorEditor|Tk::ColorEditor>. |
| 25 |
|
| 26 |
The B<chooseColor> method pops up a dialog box for the |
| 27 |
user to select a color. The following I<option-value> pairs are |
| 28 |
possible as command line arguments: |
| 29 |
|
| 30 |
=over 4 |
| 31 |
|
| 32 |
=item B<-initialcolor>=E<gt>I<color> |
| 33 |
|
| 34 |
Specifies the color to display in the color dialog when it pops |
| 35 |
up. I<color> must be in a form acceptable to the B<Tk_GetColor> |
| 36 |
function. |
| 37 |
|
| 38 |
=item B<-parent>=E<gt>$widget |
| 39 |
|
| 40 |
Makes $widget the logical parent of the color dialog. The color |
| 41 |
dialog is displayed on top of its parent window. |
| 42 |
|
| 43 |
=item B<-title>=E<gt>I<titleString> |
| 44 |
|
| 45 |
Specifies a string to display as the title of the dialog box. If this |
| 46 |
option is not specified, then a default title will be displayed. |
| 47 |
|
| 48 |
=back |
| 49 |
|
| 50 |
If the user selects a color, B<tk_chooseColor> will return the |
| 51 |
name of the color in a form acceptable to B<Tk_GetColor>. If the |
| 52 |
user cancels the operation, the command will return B<undef>. |
| 53 |
|
| 54 |
=head1 EXAMPLE |
| 55 |
|
| 56 |
$widget->configure(-fg => $parent->chooseColor(-initialcolor => 'gray', |
| 57 |
-title => "Choose color")); |
| 58 |
|
| 59 |
=head1 KEYWORDS |
| 60 |
|
| 61 |
color selection dialog |
| 62 |
|
| 63 |
=cut |
| 64 |
|