NAME:

Object: SearchForm


SYNOPSIS:

use class::SearchForm;


DIRECTORY/FILE:

The file SearchForm.pm is located in the subdirectory './class'


DESCRIPTION:

The object SearchForm encapsulates the search and replace window. It is now coded as a normal non-visual Perl class that creates an user interface in the $self->{'ui'} branch. It might be more clever to (later) transform it into a Toplevel-derived widget.


STATUS:

Coding: 60% done

Documentation: up-do-date

NOTE: Here all objects get correctly destroyed after closing the window --> !NO CIRCULAR REFERENCES!


ATTRIBUTES:

Do not set/read them directly, use the Get/Set methods instead.

$self->{'docform'} #A reference to the DocForm object this window is associated with

$self->{'ui'}->{'_top'} #A referenece to the Toplevel

$self->{'ui'}->{...the rest of this branch...} #References to the widgets that build the user interface


Class variables:


METHODS:


Class Methods:


Constructors:


new

$object = SearchForm->new($docform);

This constructor creates a new object of the class SearchForm.

Parameters:

(+) $docform: A reference to the DocForm object the SearchForm was created from


Destructors:


DESTROY

The standard automatically called PERL destructor for objects. Unfortionatly it is called very late (when the whole application terminates.)


do_detstroy

$object->do_detsroy();

This destructor is binded to the protocol-message WM_DELETE_WINDOW and performs the cleanup stuff, destroys the Toplevel manually and then destroys the SearchForm object manually too.


Public data methods (=Get/Set methods):


docform

$ref_docform = $object->docform(); #gets a reference to the associated DocForm object

$object ->docform($ref_docform); #sets a reference to the associated DocForm object


top

$ref_top = $object->top(); #gets a reference to the Tolevel window (READ-ONLY)


Other public methods:


search

$object->search();

Starts the search.

If something is found, the function returns an reference to an hash that is constructed like this:

$ref_hash->{'start_index'} contains the startindex of the hit

$ref_hash->{'end_index'} contains the endindex of the hit

If nothing was found, the function returns 0;


replace

$object->replace();

Makes the replacement for one hit.

If something is replaced, the function returns 1, if it just selected something it returns -1, if there are no hits anymore it returns 0.


replace_all

$object->replace_all();

Makes the replacement for all hits.

If something is replaced, the function returns 1, else it returns 0


Private methods:


_text_entered

$object->_text_entered()

A callback to switch the state of the buttons on and of depending on wether there is some text in the LabEntries or not.


_replace

$object->_replace($result)

Performs the replacement for the replace() and the replace_all() methods.

Parameters

(+) $result: The result of the actual search-run = method search()


_update_history

$object->_update_history()

Updates the search and replace history.


KNOWN BUGS:


STILL MISSING: