Package Forms::Dnav
A Navigation toolbar (nvabar for short), that can be used for a mainwindow, and that has two predefinned menu, or that can be used to navigate the records in a subform (and the menu are hidden then).
This module should be placed under a lib directory and the PERL5LIB environment variable should point to it.
Forms::Tools
a glad xml file with path lib/Forms/dnav.bld and the lib directory beeing define in the PERL5LIB environement variable (ie U:\docs\perl\lib on my pc)
$self->{dnav} = Forms::Dnav->new(); my $b = $self->{dnav}->get_builder; $b->add_from_file( some glade files ) or die "Couldn't read ..."; $b->connect_signals($self);
Build a navbar around a mainform
$self->{dnav} = Forms::Dnav->new(0);
Get a new Dnav object that will be used for a subform navigation. The predefinned menu in the navbar will not show
$self->{dnav}-connect_signal_for("button name", \&code_ref, $data, $signal); $self->{dnav}->connect_signal_for("mainwindow", \>k_main_quit, $self, "destroy" );
Where
button name is the button id in the glade file
&code_ref is a function to be called on click (default) unless a string is given in $signal
$data a ref to the Dnav object or to the main form object
$self->{dnav}->set_dataref($self->{jrn});
$self->{jrn} est une ref à un recordset issu de Gtk2::Ex::DBI->new ()
$self->{jrn}
Gtk2::Ex::DBI->new ()
my $w =$self->{glade_xml}->get_object('jrn'); my $ctr= $self->{glade_xml}->get_object('vbox1'); $self->{dnav}->reparent($ctr, $w);
$self->{glade_xml}->get_object('jrn'); is a ref to the top window of the form
$self->{glade_xml}->get_object('jrn');
$self->{glade_xml}->get_object('vbox1'); is a ref to the first vbox that is a child of this top window
$self->{glade_xml}->get_object('vbox1');
$self->{dnav}->reparent($ctr, $w); place the content of the $ctr widget in the navbar, take the title of $w and place it in the navbar and destroy this window
$self->{dnav}->reparent($ctr, $w);
$ctr
$w
To install Gtk2::Ex::DbLinker, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gtk2::Ex::DbLinker
CPAN shell
perl -MCPAN -e shell install Gtk2::Ex::DbLinker
For more information on module installation, please visit the detailed CPAN module installation guide.