Object: SearchForm
use class::SearchForm;
The file SearchForm.pm is located in the subdirectory './class'
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.
Coding: 60% done
Documentation: up-do-date
NOTE: Here all objects get correctly destroyed after closing the window --> !NO CIRCULAR REFERENCES!
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
$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
The standard automatically called PERL destructor for objects. Unfortionatly it is called very late (when the whole application terminates.)
$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.
$ref_docform
= $object->docform(); #gets a reference to the
associated DocForm object
$object
->docform($ref_docform); #sets a reference to the
associated DocForm object
$ref_top
= $object->top(); #gets a reference to the Tolevel
window (READ-ONLY)
$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;
$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.
$object->replace_all();
Makes the replacement for all hits.
If something is replaced, the function returns 1, else it returns 0
$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.
$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()
$object->_update_history()
Updates the search and replace history.