[PyGTK] forbid focus of TreeView columns

Discussion in 'Python' started by Franck Pommereau, Feb 21, 2005.

  1. Hi all,

    I'm building a PyGTK interface in which I would like that no widget
    would be able to get the focus (and so to be activated by pressing the
    Return key). For this purpose, for each widget, I do:

    widget.set_property("can-focus", gtk.FALSE)

    My problem is a TreeView which has a clickable column, it get the
    default focus and I did not find how to forbid that.

    I tried:

    def focus (widget, *args) :
    try :
    widget.set_property("can-focus", gtk.FALSE)
    except :
    pass
    try :
    widget.set_property("can-default", gtk.FALSE)
    except :
    pass
    win.forall(focus)

    where win is my application window (I also tried on the TreeView) but it
    doesn't work. :-(
    I also tried with widget.unset_flags, same result. :-((

    If I choose another widget and give it the default focus
    (widget.grab_default and widget.grab_focus) it's OK until I click on the
    column which then keeps the focus. :-(((

    I'm sure I could capture the Return key but I don't want to have this
    dashed line around the focused widget...

    I think that this column has somewhere an associated widget but I could
    not find it anywhere (and neither could win.forall).

    I'm using PyGTK-2.0.0 and cannot use another version.

    Thanks in advance for any idea!
    Franck
     
    Franck Pommereau, Feb 21, 2005
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ernst Murnleitner

    possibility to forbid use of "this"?

    Ernst Murnleitner, Jan 7, 2004, in forum: C++
    Replies:
    14
    Views:
    866
    Ernst Murnleitner
    Jan 9, 2004
  2. Replies:
    0
    Views:
    511
  3. Peter TB Brett

    Detecting window focus events in PyGTK

    Peter TB Brett, Aug 28, 2006, in forum: Python
    Replies:
    0
    Views:
    562
    Peter TB Brett
    Aug 28, 2006
  4. =?Utf-8?B?UEs5?=
    Replies:
    0
    Views:
    767
    =?Utf-8?B?UEs5?=
    Feb 25, 2007
  5. nguillot
    Replies:
    5
    Views:
    633
    James Kanze
    Mar 20, 2009
  6. Peng Yu
    Replies:
    3
    Views:
    170
    J├╝rgen Exner
    Nov 30, 2008
  7. Skot

    Firefox close forbid

    Skot, Oct 3, 2005, in forum: Javascript
    Replies:
    3
    Views:
    166
  8. Roger
    Replies:
    3
    Views:
    597
Loading...