Gtk3::Ex::DBI::Form

A Gtk3::Ex::DBI::Form in action

A Gtk3::Ex::DBI::Form in action

High Level Description

The ‘Form’ class binds widgets in a window to a fields in a database table. You design the GUI in Glade, which is a very nice GU I builder for Gtk3. Currently supported widgets are: [ Text Entry , Combo Box , Text View ,  Check Button , Radio Button , Spin Button , Calendar ]. This class will then bind any fields in the recordset to widgets in the Gtk3::Window based on their names ( ie name your widgets the same as the DB fields ). You can specify a prefix if there could be name clashes.

Form-specific Features

The following are features above the shared ( form / datasheet ) functionality:

  • Record paging. Developers can set ( or expose to users ) a page size, allowing users to open a large table without having to load the entire table into memory at once.
  • Search dialog for modifying the filter ( where ) clause
  • Calculator dialog for adding a series of values and setting the result back in a target field

Usage

Most of the functionality of Forms / Datasheets is set up in a hash that you pass to the constructor. A simple one might look like:

$self->{param_value} = Gtk3::Ex::DBI::Form->new(
{
    dbh => $dbh
  , sql => {
               select => "*"
             , from => "PARAM_VALUE"
    }
  , builder => $builder
 }
);

Full documentation is embedded in the software via POD. CPAN’s POD viewer does a reasonable job of displaying it: http://search.cpan.org/~dkasak/Gtk3-Ex-DBI-Form-3.1/lib/Gtk3/Ex/DBI/Form.pm

Screenshot description

This example in the screenshot at the top of the page shows various widgets ( combo box, toggle button, text entry ) in action. The Recordset Tools section is new in the Gtk3 port of this software. You can pass the constructor a Gtk3::Box and instruct it to build the ‘recordset tools’, which can include:

  • Recordset status indicator ( in this case: Synchronized )
  • Buttons for insert, undo, delete, apply
  • Recordset Spinner ( a spin button to navigate records ) – not shown in this screenshot

Leave a Reply