NAME

Gtk2::Ex::DbLinker::DatasheetHelper - Common methods for Gtk2::Ex::DbLinker::Datasheet and Wx::Perl::DbLinker::Wxdatasheet

SYNOPSIS

See Gtk2::Ex::DbLinker::Datasheet and Wx::Perl::DbLinker::Wxdatasheet. The methods in this module are not supposed to be called directly.

new

parameters:

cols

Array ref of fields name

dman

A xxxDataManager object

col_number

A code ref of a function returning the field position (0 based) from its name

$self->{ds_helper} = Gtk2::Ex::DbLinker::DatasheetHelper->new(
    cols       => $self->{cols},
    dman       => $self->{dman},
    col_number => \&{ $self->colnumber_from_name },

);

init

In a datasheet module, calls init to pass a list of code refs that will be used when apply is called.

Mandatory parameters: a list of function references, the keys are

next

returning the next row. Parameter the current iterator or row number

set_val

setting the value for a given row and column. Parameters are row and column number, value

get_val

returning the value for a given row and column. Parameters: row and column number

del_row

deleting a row. Parameter: row and column number

has_more_row

returning 1 or 0 if there are more rows after the curreont one.

iter

the iterator or row position of the first row.

    $self->{ds_helper}->init(
   	sig =>  $self->{changed_signal},
	sig_block => sub { $self->{log}->debug("sig_block"); $model->signal_handler_block($_[0])},
   	sig_unblock =>  sub { $model->signal_handler_unblock($_[0]) },
   	next =>  sub {$model->iter_next($_[0])},
   	get_val => sub {$self->{log}->debug("get_val col: ", $_[1]); 
                                my $x = $model->get($_[0], $_[1]); 
                                $self->{log}->debug("get_val found ",  $x); 
                                 return $x
                        },
   	set_val => sub {  $self->{log}->debug("set_val", $_[2]); $model->set($_[0], $_[1], $_[2])},
   	del_row =>  sub  { $model->remove($_[0]) },
   	has_more_row => sub { return ( defined $iter ? 1 : 0 )},
    	iter => $iter,

   );

apply

Call apply after init to transmit to the database via the datamanager, the changes (a row deletion, a row addition, a row modification) made in the datasheet

SUPPORT

Any Gk2::Ex::DbLinker questions or problems can be posted to me (rappazf) on my gmail account.

The current state of the source can be extract using Mercurial from http://sourceforge.net/projects/gtk2-ex-dblinker/.

AUTHOR

François Rappaz <rappazf@gmail.com>

COPYRIGHT

Copyright (c) 2016 by F. Rappaz. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Gtk2::Ex::DbLinker::Datasheet Wx::Perl::DbLinker::Wxdatasheet.