Gtk2-Ex-DBI
view release on metacpan or search on metacpan
lib/Gtk2/Ex/DBI.pm view on Meta::CPAN
# the combo box functionality is used. If the Entry functionality is used ( ie someone types a
# string that matches one in the list ), NOTHING is registered, and the active iter is not set.
# We *NEED* to work around this until the bug is fixed, otherwise ComboBoxEntrys are horribly broken.
# Therefore we connect the sub set_active_iter_for_broken_combo_box to the on_focus_out event.
# See http://bugzilla.gnome.org/show_bug.cgi?id=156017
# Note that while the above bug page shows this bug as being 'FIXED', I've yet to see this
# fix materialise in Gtk2 - when it does I will limit our work-around to those affected
# versions of Gtk2.
# - Use the populate-popup signal of Gtk2::Entry widgets to add the 'find' menu item
# - Connect to the 'key-press-event' signal of various widgets to move the focus along
# ( ie as if the TAB key was pressed )
# We also keep an array of widgets and signal ids so that we can disconnect all signal handlers
# and cleanly destroy ourselves when requested
# We also set up input / output formatters based on widget ( ie $self->{widgets} )
# Set up some defaults for different widget types
lib/Gtk2/Ex/DBI.pm view on Meta::CPAN
}
push @{$self->{objects_and_signals}},
[
$child_widget,
$signal
];
# We also want a right-click menu for a Combo's child ( entry )
$signal = $child_widget->signal_connect_after(
'populate-popup' => sub { $self->build_right_click_menu(@_) } );
if ( $self->{debug} ) {
warn "Remembering object / signal pair for later disconnection ...\n"
. " Field: $fieldname\n"
. " Widget: $child_widget\n"
. " Signal: $signal\n\n";
}
push @{$self->{objects_and_signals}},
[
$child_widget,
lib/Gtk2/Ex/DBI.pm view on Meta::CPAN
} elsif ( $type eq "Gtk2::CheckButton" ) {
push @signals, $widget->signal_connect_after(
toggled => sub { $self->changed( $fieldname ) } );
} elsif ( $type eq "Gtk2::Entry" ) {
push @signals, $widget->signal_connect_after(
changed => sub { $self->changed( $fieldname ) } );
push @signals, $widget->signal_connect_after(
'populate-popup' => sub { $self->build_right_click_menu(@_) } );
push @signals, $widget->signal_connect(
'activate' => sub { $self->{window}->child_focus('tab-forward') } );
} elsif ( $type eq "Gtk2::SpinButton" ) {
push @signals, $widget->signal_connect_after(
changed => sub { $self->changed( $fieldname ) } );
push @signals, $widget->signal_connect_after(
'populate-popup' => sub { $self->build_right_click_menu(@_) } );
push @signals, $widget->signal_connect(
'key-press-event' => sub { $self->process_entry_keypress(@_) } );
} else {
push @signals, $widget->signal_connect_after(
changed => sub { $self->changed( $fieldname ) } );
}
# ... and then warn() some info about what we're doing, and also append
( run in 1.472 second using v1.01-cache-2.11-cpan-364913b4093 )