Tk-TipEntry
view release on metacpan or search on metacpan
lib/Tk/TipEntry.pm view on Meta::CPAN
package Tk::TipEntry;
use 5.008008;
use strict;
use warnings;
use Tk;
use Tk::Entry;
our $VERSION = '0.06';
use base qw(Tk::Derived Tk::Entry);
Construct Tk::Widget 'TipEntry';
=head1 NAME
Tk::TipEntry - An entry with tooltip in the entry if it's empty
=head1 SYNOPSIS
use strict;
use Tk::TipEntry;
my $entry = $parent->FilterEntry(
-tip => 'Search...', # will be the default hint text when entry is empty
);
$entry->pack();
=head1 DESCRIPTION
This widget is derived from L<Tk::Entry>. It implements an other kind of
tooltip, that is displayed inside the entry when it's empty.
The tooltip will be removed, if the entry gets the focus and reinserted, if
the entry loses the focus and it's value is empty (C<$entry-E<gt>get() eq ''>).
In addition, the entry evaluates the escape key. If the entry has the focus
and the escape key is pressed, the original input will be restored. If there
is no previous input, the tooltip will be displayed again.
=head1 OPTIONS
Any option exept the C<-tip> will be passed to the construktor of the
L<Tk::Entry>. The -text option is altered minimally.
=head2 -tip
(new option)
Specify the tooltip, that will be displayed.
The default value is 'Search...'.
=head2 -text
(altered option)
If there is no C<-text> attribute for the Entry, the tooltip will be set initially
as default text. Specify C<-text> if you want another initial input.
The default value is the same as for -tip.
=head1 METHODS
=cut
# ClassInit( $class, $mw )
#
# Bind FocusIn, FocusOut and Escape to events.
( run in 0.795 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )