[Sugar-devel] How to make a GTK3 EventBox accept the focus?
James Simmons
nicestep at gmail.com
Wed Feb 27 11:53:26 EST 2013
Aneesh,
I'm trying to incorporate your GTK3 update to View Slides and release the
result on ASLO. The problem I'm still having is that I cannot page through
the images using the keyboard as I used to. What I did in the past was to
nest the image control in an event box and make the event box able to
accept the focus. Then the user clicks on the image with the mouse to set
the focus and at that point the event box receives key press events.
When you upgraded View Slides to use GTK3 you removed the code to make the
event box focusable. I have tried to replace the missing line of code with
what seems to be the GTK3 equivalent but it isn't working. I've done a lot
of google searches trying to figure out the problem and I'm not getting
anywhere. I cannot release View Slides as it is. It really needs to be
able to navigate through the images with the keyboard to be usable.
I'm hoping you might have some thoughts or maybe an idea of how to do the
keyboard paging a different way.
James Simmons
On Mon, Feb 25, 2013 at 6:20 AM, Manuel Quiñones <manuq at laptop.org> wrote:
> Hi James,
>
> 2013/2/24 James Simmons <nicestep at gmail.com>:
> > I was looking at the upgrade to GTK3 done for View Slides and it seems
> that
> > it no longer responds to the keyboard. What I had done previously to
> get it
> > to do that was to put the image I was displaying in an event box. I then
> > made the event box accept the focus like this:
> >
> > self.eventbox.set_events(gtk.gdk.KEY_PRESS_MASK |
> gtk.gdk.BUTTON_PRESS_MASK)
> > self.eventbox.set_flags(gtk.CAN_FOCUS)
> >
> > The Gtk3 port changed the code to this:
> >
> > self.eventbox.set_events(Gdk.EventMask.KEY_PRESS_MASK |
> > Gdk.EventMask.BUTTON_PRESS_MASK)
> >
> > There was no code to make it accept the focus. I tried adding this:
> >
> > self.eventbox.set_can_focus(True)
> >
> > This does not prevent the Activity from running, but it doesn't make the
> > Event Box focusable either.
>
> Have you tried self.eventbox.grab_focus() ?
>
> http://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-grab-focus
>
> --
> .. manuq ..
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20130227/2f5b395d/attachment.html>
More information about the Sugar-devel
mailing list