Tkx::FindBar - Perl Tkx extension for an incremental search toolbar
use Tkx; use Tkx::FindBar; my $mw = Tkx::widget->new('.'); my $text = $mw->new_text(); my $findbar = $mw->new_tkx_FindBar(-textwidget => $text); $text->g_pack(); $findbar->g_pack(); $findbar->hide(); # remove until requested by user # Bindings to display and hide toolbar and navigate matches. $findbar->add_bindings($mw, '<Control-f>' => 'show', '<Escape>' => 'hide', '<F3>' => 'next', '<Control-F3>' => 'previous', ); Tkx::MainLoop();
Tkx::FindBar is a Tkx megawidget that provides a toolbar for searching in a text widget. Using a toolbar for a search UI is much less obtrusive than a dialog box. The search is done incrementally (also known as "find as you type"). The toolbar may be hidden and shown as needed.
Tkx::FindBar was inspired by the great find toolbar in Mozilla Firefox.
-textwidget => widget
Defines the widget to search in. This must be a text widget (or act like one).
-highlightcolor => color
Defines the background color used to highlight found text. The default value is #80FF80.
-tile
If set to 1 (the default) and the Tk tile package is available, the FindBar will be drawn using themed widgets to acheive a platform native appearance. If set to 0 or tiling is not available the standard widgets will be used instead.
hide
Hides the FindBar widget.
show
Shows the FindBar widget if hidden and focuses the entry subwidget.
first
Finds the first instance of the search text.
next
Finds the next instance of the search text. (Searches forwards.)
previous
Finds the previous instance of the search text. (Searches backwards.)
add_bindings
Shortcut method for bulk addition of bindings (e.g. to create keygboard shortcuts). The first argument is the widget to bind to. The remaining arguments are bind tag/method name pairs. Multiple tags may be bound to the same method.
The show and hide methods don't work with the place geometry manager. (The pack and grid geometry managers are supported.)
There's no support for configuring subwidgets.
Please report any bugs or feature requests to bug-tkx-findbar at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Tkx-FindBar. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-tkx-findbar at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Tkx::FindBar
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Tkx-FindBar
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Tkx-FindBar
CPAN Ratings
http://cpanratings.perl.org/d/Tkx-FindBar
Search CPAN
http://search.cpan.org/dist/Tkx-FindBar
Michael J. Carman, <mjcarman at cpan.org>
<mjcarman at cpan.org>
Copyright (C) 2008-2009 by Michael J. Carman
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The icons are Copyright (C) the Tango Desktop Project [http://tango.freedesktop.org/Tango_Desktop_Project]. They are used under the terms of the Creative Commons Attribution-Share Alike License [http://creativecommons.org/licenses/by-sa/2.5/]. They're a heck of a lot better than anything I could come up with, so I'm grateful for being able to use them. Thanks, guys!
To install Tkx::FindBar, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tkx::FindBar
CPAN shell
perl -MCPAN -e shell install Tkx::FindBar
For more information on module installation, please visit the detailed CPAN module installation guide.