The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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.
   $findbar->add_bindings($mw,
      '<Control-f>'  => 'show',
      '<Escape>'     => 'hide',
      '<F3>'         => 'next',
      '<Control-F3>' => '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 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.

LIMITATIONS

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.

BUGS

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.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Tkx::FindBar

You can also look for information at:

AUTHOR

Michael J. Carman, <mjcarman at cpan.org>

COPYRIGHT AND LICENSE

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!