NAME

Tkx::FindBar - Perl Tkx extension for an incremental search toolbar

SYNOPSIS

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.
$mw->g_bind('<Control-f>',  sub { $findbar->show()     } );
$mw->g_bind('<Escape>',     sub { $findbar->hide()     } );
$mw->g_bind('<F3>',         sub { $findbar->next()     } );
$mw->g_bind('<Control-F3>', sub { $findbar->previous() } );

Tkx::MainLoop();

DESCRIPTION

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.

WIDGET-SPECIFIC OPTIONS

-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.

METHODS

hide

Hides the FindBar widget.

show

Shows the FindBar widget.

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.)

BUGS

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.

AUTHOR

Michael Carman, <mjcarman@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2008 by Michael Carman

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.

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!