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

NAME

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.

Depends also on

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

SYNOPSIS

        $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", \&gtk_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});
 

Where

  • $self->{jrn} est une ref à un recordset issu de 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);
 

Where

  • $self->{glade_xml}->get_object('jrn'); is a ref to the top window of the form

  • $self->{glade_xml}->get_object('vbox1'); is a ref to the first vbox that is a child of this top window

  • $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