Re: grab_default doesn't seem to grab.



Thank to Chris for checking and confirming.

As I came across this while working on updating the Gtk2-perl tutorial
I'm just going to remove mention of this bug/feature in examples and
note this confusing behaviour when I get to the function's specific
section in the documentation.

2009/5/30 csincock-gmail <csincock gmail com>:

perhaps this 'fix' from 1999 is causing the problem
http://mail.gnome.org/archives/gtk-app-devel-list/1999-January/msg00134.html

anyway I ran your script and it doesn't work for me either.
also it seems that gtk is lying about the whole situation.
I added print statements:
print STDERR $close_button->has_default;
print STDERR $close_button->receives_default;
and it reports them both as true.

what's more, calling $window->activate_default after the window is realised
successfully sends a 'activate' signal to the close button, but neither
buttons clicked handler is called (I guess cos 'activation' is
different than clicking if the activate is triggered programatically).

Also, if both buttons have $button->can_focus(FALSE)
then the enter key seems to succesfully invoke the close buttons activate
signal handler and it's clicked signal handler.

perhaps having 'focus' support and a 'default' support are
mutually exclusive in the situation where multiple widgets
accept an enter key when focused?

I think the only way you'll get it to work is by also playing
around with the focus.

having said that, perhaps just focusing the close button is the way
to go. alternatively you could also add a key event handler to the toplevel
widget to intercept the enter key and call window->activate if you also
connected your close handler to 'activate'.

I agree with you that the behaviour is not what the docs would seem
to indicate, but because of the interactions of focus handling etc,
I wouldn't be surprised if anybody in the world could say how it is
really "meant" to work. If you collated all the hundreds of single-liner
comments in the docs for the various focus and 'default' related features,
you'd probably find plenty of contradictions.

cheers
Date: Fri, 29 May 2009 14:27:55 +0200
From: Cowley Harris <warewolfe gmail com>
Subject: grab_default doesn't seem to grab.


Trying to understand why grab_default doesn't seem to work like the
way I interpreted the documentation.
Can somebody run this script and see if the issue is explicable ?

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list




-- 
"that which does not kill us will give us six  more weeks of winter",
Nietzschean Groundhog Theory



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