Re: Gtk2::Entry not getting events



On Mon, 2 Oct 2006 10:34:16 +0200
"Dirk vdw" <dirkvanderwalt gmail com> wrote:

I'm attempting to create a fancy pop-up window (a typical notification
bubble).

It is a shaped window which also change color as you enter / leave with the
mouse.
The idea is that you specify a widget to pack inside it upon creation.
I've created a 'mock-up' with the typical password change screen.

Problem:
The Gtk2::Entry widgets packed inside the inserted widget does not respond
to any keyboard events. (The buttons work fine though â with the mouse).

Many thanks.

Hi,  I'm just a hacker, and did this more by guessing and looking at other
examples, but I found a solution. Change your on_show() sub to the
following:

#This will start the timeout handler if the timeout value was more than 0 
sub on_show(){
    my ($self,$event) = @_;
    $self->signal_chain_from_overridden;

# added to correct keyboard grab
#needs 0 not 1 for second arg #################################### 
    my $rc = Gtk2::Gdk->keyboard_grab($self->{msgVBox}->window, 0 ,Gtk2->get_current_event_time);
    warn "keyboard grab failed ($rc)\n" unless $rc eq 'success';
    print "$rc\n";
####################################################################
                               
    if (($self->{closeWindowTimeoutID} == 0) && $self->{timeout} > 0){
        $self->{closeWindowTimeoutID} =
                Glib::Timeout->add(
                                    $self->{timeout},
                                    sub {
                                        hide_window_callback($self);
                                        return FALSE;
                                    }
                );
    }

}


Joe

-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]