Tk::TipEntry - An entry with tooltip in the entry if it's empty
use strict; use Tk::TipEntry; my $entry = $parent->FilterEntry( -tip => 'Search...', # will be the default hint text when entry is empty ); $entry->pack();
This widget is derived from 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 (
$entry->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.
Any option exept the
-tip will be passed to the construktor of the Tk::Entry. The -text option is altered minimally.
Specify the tooltip, that will be displayed.
The default value is 'Search...'.
If there is no
-text attribute for the Entry, the tooltip will be set initially as default text. Specify
-text if you want another initial input.
The default value is the same as for -tip.
When the entry gets the focus, the tooltip will be removed.
When the entry loses the focus and if it's empty, the tooltip will be inserted.
If the escape key is pressed, the current input will be discarded. The previous input will be inserted. If there is no previous input, the -tip will be the new input.
Populate() partially taken from Tk::Wizard.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.2 or, at your option, any later version of Perl 5 you may have available.
This module was designed after Tk::FilterEntry.
Alexander Becker, firstname.lastname@example.org